Package org.apache.wayang.core.util
Class Canonicalizer<T>
- java.lang.Object
-
- org.apache.wayang.core.util.Canonicalizer<T>
-
- All Implemented Interfaces:
java.lang.Iterable<T>,java.util.Collection<T>,java.util.Set<T>
public class Canonicalizer<T> extends java.lang.Object implements java.util.Set<T>This utility maintains canonical sets of objects.
-
-
Constructor Summary
Constructors Constructor Description Canonicalizer()Canonicalizer(int numExpectedEntries)Canonicalizer(java.lang.Iterable<? extends T> objs)Canonicalizer(java.util.Collection<? extends T> objs)Canonicalizer(T... objs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(T t)voidaddAll(java.lang.Iterable<? extends T> objs)booleanaddAll(java.util.Collection<? extends T> c)voidclear()booleancontains(java.lang.Object o)booleancontainsAll(java.util.Collection<?> c)booleanequals(java.lang.Object o)TgetOrAdd(T obj)Add the given element if it is not contained in this instance, yet.inthashCode()booleanisEmpty()java.util.Iterator<T>iterator()booleanremove(java.lang.Object o)booleanremoveAll(java.util.Collection<?> c)booleanretainAll(java.util.Collection<?> c)intsize()java.lang.Object[]toArray()<T1> T1[]toArray(T1[] a)java.lang.StringtoString()
-
-
-
Constructor Detail
-
Canonicalizer
public Canonicalizer(int numExpectedEntries)
-
Canonicalizer
public Canonicalizer()
-
Canonicalizer
public Canonicalizer(java.lang.Iterable<? extends T> objs)
-
Canonicalizer
public Canonicalizer(java.util.Collection<? extends T> objs)
-
Canonicalizer
public Canonicalizer(T... objs)
-
-
Method Detail
-
getOrAdd
public T getOrAdd(T obj)
Add the given element if it is not contained in this instance, yet.- Parameters:
obj- the element to be added potentially- Returns:
objif it was added, otherwise the existing element
-
addAll
public void addAll(java.lang.Iterable<? extends T> objs)
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
contains
public boolean contains(java.lang.Object o)
-
iterator
public java.util.Iterator<T> iterator()
-
toArray
public java.lang.Object[] toArray()
-
toArray
public <T1> T1[] toArray(T1[] a)
-
add
public boolean add(T t)
-
remove
public boolean remove(java.lang.Object o)
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
-
addAll
public boolean addAll(java.util.Collection<? extends T> c)
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
-
clear
public void clear()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
-
-