I have class that implements Set and List. Programs works fine in Java6 and Java7
public class SetList<V> implements Set<V>, List<V>
{
....
}
With Java 8 , this does not compile. Error is
java: class trials.SetList inherits unrelated defaults for spliterator() from types java.util.Set and java.util.List
java/util/Set.java:394
...
@Override
default Spliterator<E> spliterator() {
return Spliterators.spliterator(this, Spliterator.DISTINCT);
}
java/util/List.java
...
@Override
default Spliterator<E> spliterator() {
return Spliterators.spliterator(this, Spliterator.ORDERED);
}
Does it mean I cannot have class that implement both Set and List in Java 8? (It looks like time has come to pay our technical debts.)
spliterator()
. – OssuarySet
andList
in any version of Java. – Hyperostosis