Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ex05.task2
- trait SedcSet [+A] {
- def + [B >: A] (item: B): SedcSet [B]
- def - [B >: A] (item: B): SedcSet [B]
- def size(): Int
- def contains [B >: A] (item: B): Boolean
- override def equals(obj: Any /*Any is correct as parameter to equals, do not modify*/): Boolean
- override def hashCode(): Int
- def print(printer: Printer [A]): Unit
- def foreach [B] (f: A => B): Unit
- }
- object SedcSet {
- def apply[A](xs: A*): SedcSet [A] = EmptySedcSet
- }
- object EmptySedcSet extends SedcSet[Nothing] {
- override def + [A >: Nothing] (item: A): SedcSet [A] = ???
- override def -[B >: Nothing](item: B): SedcSet[B] = ???
- override def size(): Int = ???
- override def contains[B >: Nothing](item: B): Boolean = ???
- override def print(printer: Printer [Nothing]): Unit = ???
- override def foreach[B](f: Nothing => B): Unit = ()
- }
- trait Printer [-A] {
- def print(a: A):Unit
- }
- object Main {
- // You may use any Java/ Scala standard collection inside this object
- def main(args: Array[String]): Unit = {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement