Class UnmodifiableUnionSet<E>

Type Parameters:
E - the element type
All Implemented Interfaces:, java.lang.Iterable<E>, java.util.Collection<E>, java.util.Set<E>

public class UnmodifiableUnionSet<E>
extends java.util.AbstractSet<E>
An unmodifiable live view of the union of two sets.
Dimitrios Michail
See Also:
Serialized Form
  • Constructor Summary

    Constructor Description
    UnmodifiableUnionSet​(java.util.Set<E> first, java.util.Set<E> second)
    Constructs a new set.
  • Method Summary

    Modifier and Type Method Description
    boolean contains​(java.lang.Object o)  
    java.util.Iterator<E> iterator()  
    int size()
    Since the view is live, this operation is no longer a constant time operation.

    Methods inherited from class java.util.AbstractSet

    equals, hashCode, removeAll

    Methods inherited from class java.util.AbstractCollection

    add, addAll, clear, containsAll, isEmpty, remove, retainAll, toArray, toArray, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.util.Collection

    parallelStream, removeIf, stream, toArray

    Methods inherited from interface java.lang.Iterable


    Methods inherited from interface java.util.Set

    add, addAll, clear, containsAll, isEmpty, remove, retainAll, spliterator, toArray, toArray
  • Constructor Details

    • UnmodifiableUnionSet

      public UnmodifiableUnionSet​(java.util.Set<E> first, java.util.Set<E> second)
      Constructs a new set.
      first - the first set
      second - the second set
  • Method Details

    • iterator

      public java.util.Iterator<E> iterator()
      Specified by:
      iterator in interface java.util.Collection<E>
      Specified by:
      iterator in interface java.lang.Iterable<E>
      Specified by:
      iterator in interface java.util.Set<E>
      Specified by:
      iterator in class java.util.AbstractCollection<E>
    • size

      public int size()
      Since the view is live, this operation is no longer a constant time operation.
      Specified by:
      size in interface java.util.Collection<E>
      Specified by:
      size in interface java.util.Set<E>
      Specified by:
      size in class java.util.AbstractCollection<E>
    • contains

      public boolean contains​(java.lang.Object o)
      Specified by:
      contains in interface java.util.Collection<E>
      Specified by:
      contains in interface java.util.Set<E>
      contains in class java.util.AbstractCollection<E>