Package org.eclipse.cdt.core.parser.util

# Class ObjectSet<T>

java.lang.Object
org.eclipse.cdt.core.parser.util.HashTable
org.eclipse.cdt.core.parser.util.ObjectTable<T>
org.eclipse.cdt.core.parser.util.ObjectSet<T>

All Implemented Interfaces:
  `Cloneable`, `Iterable<T>`

public class ObjectSet<T> extends ObjectTable<T>

Restriction:
  This class is not intended to be subclassed by clients.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final ObjectSet`
`EMPTY_SET`
An empty immutable `ObjectSet`.

### Fields inherited from class org.eclipse.cdt.core.parser.util.ObjectTable

`keyTable`

### Fields inherited from class org.eclipse.cdt.core.parser.util.HashTable

`currEntry, hashTable, minHashSize, nextTable`

## Constructor Summary

Constructors
Constructor
Description
`ObjectSet(int initialSize)`
Constructs an empty ObjectSet, allocating an initial storage for the specified number of elements
`ObjectSet(T[] items)`
Constructs an ObjectSet populated with the specified items, or an empty ObjectSet if the parameter is null

## Method Summary

Modifier and Type
Method
Description
`void`
`addAll(List<T> list)`
Adds each item in the list to this ObjectSet, or no-ops if list is null
`void`
`addAll(ObjectSet<? extends T> set)`
Adds each item in the specified ObjectSet, or no-ops if the set is null
`void`
`addAll(T[] objs)`
Adds each of the items in the specified array, or no-ops if the array is null
`void`
`checkPut(T key)`
Adds the specified item to the set, or no-ops if the key is null
`static <T> ObjectSet<T>`
`emptySet()`
`void`
`put(T key)`
Adds the specified item to the set
`boolean`
`remove(T key)`
Remove the specified object from this ObjectSet

### Methods inherited from class org.eclipse.cdt.core.parser.util.ObjectTable

`add, clear, clone, containsKey, hash, isEquivalent, iterator, keyArray, keyArray, keyAt, lookup, removeEntry, resize, toList, toString`

### Methods inherited from class org.eclipse.cdt.core.parser.util.HashTable

`capacity, countCollisions, dumpNexts, isEmpty, linkIntoHashTable, partition, rehash, removeEntry, resize, size, sort`

### Methods inherited from class java.lang.Object

`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

## Field Details

### EMPTY_SET

public static final ObjectSet EMPTY_SET
An empty immutable `ObjectSet`.

## Constructor Details

### ObjectSet

public ObjectSet(int initialSize)
Constructs an empty ObjectSet, allocating an initial storage for the specified number of elements

Parameters:
  `initialSize` -

### ObjectSet

public ObjectSet(T[] items)
Constructs an ObjectSet populated with the specified items, or an empty ObjectSet if the parameter is null

Parameters:
  `items` -

## Method Details

### emptySet

public static <T> ObjectSet<T> emptySet()

Since:
  5.1

### checkPut

public void checkPut(T key)
Adds the specified item to the set, or no-ops if the key is null

Parameters:
  `key` - the item to add (may be null)

### put

public void put(T key)
Adds the specified item to the set

Parameters:
  `key` - the (non-null) object to store

### addAll

public void addAll(List<T> list)
Adds each item in the list to this ObjectSet, or no-ops if list is null

Parameters:
  `list` - a list (may be null)

### addAll

public void addAll(ObjectSet<? extends T> set)
Adds each item in the specified ObjectSet, or no-ops if the set is null

Parameters:
  `set` - a set (may be null)

### addAll

public void addAll(T[] objs)
Adds each of the items in the specified array, or no-ops if the array is null

Parameters:
  `objs` - an array (may be null)

### remove

public boolean remove(T key)
Remove the specified object from this ObjectSet

Parameters:
  `key` - the (non-null) object to remove
Returns:
  whether an object was removed