18#ifndef _DECAF_UTIL_HASHSET_H_
19#define _DECAF_UTIL_HASHSET_H_
69 template<
typename E,
typename HASHCODE = HashCode<E> >
117 (collection.
size() < 6 ? 11 : collection.
size() * 2));
120 while (iter->hasNext()) {
121 this->add(iter->next());
137 (collection.
size() < 6 ? 11 : collection.
size() * 2));
140 while (iter->hasNext()) {
141 this->add(iter->next());
147 delete this->backingMap;
186 virtual bool add(
const E& value) {
187 return this->backingMap->
put(value,
this);
197 this->backingMap->
clear();
220 return this->backingMap->
isEmpty();
251 this->backingMap->
remove(value);
265 return this->backingMap->
size();
272 result.append(
"decaf::util::HashSet [ size = ");
std::string toString() const
virtual decaf::util::Iterator< E > * iterator()=0
Decaf's implementation of a Smart Pointer that is a template on a Type and is Thread Safe if the defa...
Definition Pointer.h:53
This class provides a skeletal implementation of the Collection interface, to minimize the effort req...
Definition AbstractCollection.h:58
virtual bool addAll(const Collection< E > &collection)
Adds all of the elements in the specified collection to this collection.The behavior of this operatio...
Definition AbstractCollection.h:237
AbstractSet()
Definition AbstractSet.h:50
The root interface in the collection hierarchy.
Definition Collection.h:69
virtual int size() const =0
Returns the number of elements in this collection.
Hash table based implementation of the Map interface.
Definition HashMap.h:95
virtual bool put(const K &key, const V &value)
Associates the specified value with the specified key in this map (optional operation).
Definition HashMap.h:995
virtual void clear()
Removes all of the mappings from this map (optional operation).
Definition HashMap.h:933
virtual bool isEmpty() const
Definition HashMap.h:949
virtual int size() const
Definition HashMap.h:953
virtual V remove(const K &key)
Removes the value (key/value pair) for the specified key from the map, returns a copy of the value th...
Definition HashMap.h:1009
virtual Set< K > & keySet()
Returns a Set view of the keys contained in this map.
Definition HashMap.h:1035
virtual bool containsKey(const K &key) const
Returns true if this map contains a mapping for the specified key.
Definition HashMap.h:957
HashSet(const HashSet< E > &collection)
Constructs a new set containing the elements in the specified HashSet.
Definition HashSet.h:134
virtual Iterator< E > * iterator()
Returns an Iterator on the elements of this HashSet.
Definition HashSet.h:229
HashSet(HashMap< E, Set< E > *, HASHCODE > *backingMap)
Protected constructor for use by subclasses that wish to use an alternate type of backing Map.
Definition HashSet.h:161
virtual std::string toString() const
Definition HashSet.h:268
virtual bool remove(const E &value)
Removes the specified element from this set if it is present.
Definition HashSet.h:249
HashSet(int capacity, float loadFactor)
Constructs a new instance of HashSet with the specified capacity and load factor.
Definition HashSet.h:101
virtual int size() const
Returns the number of elements in this HashSet.
Definition HashSet.h:264
HashSet< E > & operator=(const Collection< E > &collection)
Definition HashSet.h:167
HashSet()
Constructs a new, empty set; the backing HashMap instance has default initial capacity (16) and load ...
Definition HashSet.h:81
virtual void clear()
Removes all elements from this HashSet, leaving it empty.
Definition HashSet.h:196
HashSet(int capacity)
Constructs a new, empty set; the backing HashMap instance has the specified initial capacity and defa...
Definition HashSet.h:90
HashMap< E, Set< E > *, HASHCODE > * backingMap
Definition HashSet.h:73
HashSet(const Collection< E > &collection)
Constructs a new set containing the elements in the specified collection.
Definition HashSet.h:114
virtual ~HashSet()
Definition HashSet.h:145
virtual bool contains(const E &value) const
Searches this HashSet for the specified object.
Definition HashSet.h:208
virtual bool isEmpty() const
Returns true if this HashSet has no elements, false otherwise.
Definition HashSet.h:219
virtual Iterator< E > * iterator() const
Definition HashSet.h:233
virtual bool add(const E &value)
Adds the specified element to this set if it is not already present.
Definition HashSet.h:186
Defines an object that can be used to iterate over the elements of a collection.
Definition Iterator.h:34
Definition NoSuchElementException.h:31
A collection that contains no duplicate elements.
Definition Set.h:45
#define DECAF_CATCHALL_NOTHROW()
A catch-all that does not throw an exception, one use would be to catch any exception in a destructor...
Definition ExceptionDefines.h:62
Definition AbstractCollection.h:33
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition AprPool.h:25