Package org.eclipse.mat.collect
Class SetLong
java.lang.Object
org.eclipse.mat.collect.SetLong
- All Implemented Interfaces:
Serializable
Utility class to hold a set of longs
Similar to a Set, but efficient for longs
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(long key) Add a value to the set.voidclear()clear all the entriesbooleancontains(long key) Find a value from the setbooleanisEmpty()is the set emptyiterator()get an iterator to go through the setbooleanremove(long key) Remove a value from the setintsize()get the number of used entrieslong[]toArray()convert to an array
-
Constructor Details
-
SetLong
public SetLong()Create a set of default size -
SetLong
public SetLong(int initialCapacity) Create a set of given size- Parameters:
initialCapacity- in number of longs
-
-
Method Details
-
add
public boolean add(long key) Add a value to the set.- Parameters:
key- the value to add- Returns:
- return true if added
-
remove
public boolean remove(long key) Remove a value from the set- Parameters:
key- the value to add- Returns:
- return true if removed
-
contains
public boolean contains(long key) Find a value from the set- Parameters:
key- the value to find- Returns:
- return true if found
-
size
public int size()get the number of used entries- Returns:
- the number of entries
-
isEmpty
public boolean isEmpty()is the set empty- Returns:
- true if empty
-
clear
public void clear()clear all the entries -
iterator
get an iterator to go through the set- Returns:
- the iterator
-
toArray
public long[] toArray()convert to an array- Returns:
- a copy of the entries
-