Top Inners Fields Constructors Methods
org.jruby.util.collections

public Class HashMapInt<V>

extends Object
Class Inheritance
Known Direct Subclasses
org.jruby.util.collections.HashMapInt.NullMap
Imports
java.util.AbstractCollection, .AbstractSet, .Collection, .Iterator, .NoSuchElementException, .Set

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
private class
private class
private abstract class
private class
private class
private static class
private class
private class

Field Summary

Modifier and TypeField and Description
private int
private transient Set<HashMapInt.Entry<V>>
private final boolean
pack-priv transient volatile Set<V>
private final float
private HashMapInt.Entry<V>[]
private int
pack-priv transient volatile Collection<Integer>

Constructor Summary

AccessConstructor and Description
public
public
HashMapInt(boolean identity)

public
HashMapInt(int initialCapacity, boolean identity)

public
HashMapInt(int initialCapacity, float loadFactor, boolean identity)

Method Summary

Modifier and TypeMethod and Description
public synchronized void
public Object
clone()

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.

public boolean
contains(int value)

public boolean
public boolean
containsValue(int value)

public Set<HashMapInt.Entry<V>>
public int
get(V key)

pack-priv HashMapInt.Entry<V>
getEntry(V key)

private <V> int
getHash(V key)

public boolean
private <V> boolean
public Set<V>
pack-priv Iterator<HashMapInt.Entry<V>>
pack-priv Iterator<V>
pack-priv Iterator<Integer>
public static <U> HashMapInt<U>
public int
put(V key, int value)

protected void
public int
remove(V key)

public int
size()

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public Collection<Integer>
Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

countback to summary
private int count
entrySetback to summary
private transient Set<HashMapInt.Entry<V>> entrySet
identityback to summary
private final boolean identity
keySetback to summary
pack-priv transient volatile Set<V> keySet
loadFactorback to summary
private final float loadFactor
tableback to summary
private HashMapInt.Entry<V>[] table
thresholdback to summary
private int threshold
valuesback to summary
pack-priv transient volatile Collection<Integer> values

Constructor Detail

HashMapIntback to summary
public HashMapInt()
HashMapIntback to summary
public HashMapInt(boolean identity)
HashMapIntback to summary
public HashMapInt(int initialCapacity, boolean identity)
HashMapIntback to summary
public HashMapInt(int initialCapacity, float loadFactor, boolean identity)
Annotations
@SuppressWarnings:unchecked

Method Detail

clearback to summary
public synchronized void clear()
cloneback to summary
public Object clone()

Overrides java.lang.Object.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Returns:Object

a clone of this instance.

Annotations
@Override
containsback to summary
public boolean contains(int value)
containsKeyback to summary
public boolean containsKey(Object key)
containsValueback to summary
public boolean containsValue(int value)
entrySetback to summary
public Set<HashMapInt.Entry<V>> entrySet()
getback to summary
public int get(V key)
getEntryback to summary
pack-priv HashMapInt.Entry<V> getEntry(V key)
getHashback to summary
private <V> int getHash(V key)
isEmptyback to summary
public boolean isEmpty()
keyMatchesback to summary
private <V> boolean keyMatches(V key, HashMapInt.Entry<V> e)
keySetback to summary
public Set<V> keySet()
newEntryIteratorback to summary
pack-priv Iterator<HashMapInt.Entry<V>> newEntryIterator()
newKeyIteratorback to summary
pack-priv Iterator<V> newKeyIterator()
newValueIteratorback to summary
pack-priv Iterator<Integer> newValueIterator()
nullMapback to summary
public static <U> HashMapInt<U> nullMap()
Annotations
@SuppressWarnings:unchecked
putback to summary
public int put(V key, int value)
rehashback to summary
protected void rehash()
removeback to summary
public int remove(V key)
sizeback to summary
public int size()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
valuesback to summary
public Collection<Integer> values()
org.jruby.util.collections back to summary

public Class HashMapInt.Entry<V>

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final int
pack-priv final V
pack-priv HashMapInt.Entry<V>
pack-priv int

Constructor Summary

AccessConstructor and Description
protected
Entry(int hash, V key, int value, HashMapInt.Entry<V> next)

Method Summary

Modifier and TypeMethod and Description
public V
public int
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

hashback to summary
pack-priv final int hash
keyback to summary
pack-priv final V key
nextback to summary
pack-priv HashMapInt.Entry<V> next
valueback to summary
pack-priv int value

Constructor Detail

Entryback to summary
protected Entry(int hash, V key, int value, HashMapInt.Entry<V> next)

Method Detail

getKeyback to summary
public V getKey()
getValueback to summary
public int getValue()
org.jruby.util.collections back to summary

private Class HashMapInt.EntryIterator

extends HashMapInt<V>.HashIterator<HashMapInt.Entry<V>>
Class Inheritance

Field Summary

Inherited from org.jruby.util.collections.HashMapInt.HashIterator:
indexnext

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public HashMapInt.Entry<V>
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

Inherited from org.jruby.util.collections.HashMapInt.HashIterator:
hasNextnextEntryremove

Constructor Detail

EntryIteratorback to summary
private EntryIterator()

Method Detail

nextback to summary
public HashMapInt.Entry<V> next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:HashMapInt.Entry<V>

the next element in the iteration

org.jruby.util.collections back to summary

private Class HashMapInt.EntrySet

extends AbstractSet<HashMapInt.Entry<V>>
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Overrides java.util.AbstractCollection.clear.

Implements java.util.Set.clear, java.util.Collection.clear.

Removes all of the elements from this set (optional operation).

public boolean
contains(Object
element whose presence in this set is to be tested
o
)

Overrides java.util.AbstractCollection.contains.

Implements java.util.Set.contains, java.util.Collection.contains.

Returns true if this set contains the specified element.

public Iterator<HashMapInt.Entry<V>>
iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Set.iterator, java.util.Collection.iterator.

Returns an iterator over the elements in this set.

public boolean
remove(Object
object to be removed from this set, if present
o
)

Overrides java.util.AbstractCollection.remove.

Implements java.util.Set.remove, java.util.Collection.remove.

Removes the specified element from this set if it is present (optional operation).

public int
size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Returns the number of elements in this set (its cardinality).

Inherited from java.util.AbstractSet:
equalshashCoderemoveAll

Constructor Detail

EntrySetback to summary
private EntrySet()

Method Detail

clearback to summary
public void clear()

Overrides java.util.AbstractCollection.clear.

Implements java.util.Set.clear, java.util.Collection.clear.

Doc from java.util.Set.clear.

Removes all of the elements from this set (optional operation). The set will be empty after this call returns.

Annotations
@Override
containsback to summary
public boolean contains(Object o)

Overrides java.util.AbstractCollection.contains.

Implements java.util.Set.contains, java.util.Collection.contains.

Doc from java.util.Set.contains.

Returns true if this set contains the specified element. More formally, returns true if and only if this set contains an element e such that Objects.equals(o, e).

Parameters
o:Object

element whose presence in this set is to be tested

Returns:boolean

true if this set contains the specified element

Annotations
@Override
iteratorback to summary
public Iterator<HashMapInt.Entry<V>> iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Set.iterator, java.util.Collection.iterator.

Doc from java.util.Set.iterator.

Returns an iterator over the elements in this set. The elements are returned in no particular order (unless this set is an instance of some class that provides a guarantee).

Returns:Iterator<HashMapInt.Entry<V>>

an iterator over the elements in this set

removeback to summary
public boolean remove(Object o)

Overrides java.util.AbstractCollection.remove.

Implements java.util.Set.remove, java.util.Collection.remove.

Doc from java.util.Set.remove.

Removes the specified element from this set if it is present (optional operation). More formally, removes an element e such that Objects.equals(o, e), if this set contains such an element. Returns true if this set contained the element (or equivalently, if this set changed as a result of the call). (This set will not contain the element once the call returns.)

Parameters
o:Object

object to be removed from this set, if present

Returns:boolean

true if this set contained the specified element

Annotations
@Override
sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Doc from java.util.Set.size.

Returns the number of elements in this set (its cardinality). If this set contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of elements in this set (its cardinality)

org.jruby.util.collections back to summary

private abstract Class HashMapInt.HashIterator<T>

extends Object
implements Iterator<T>
Class Inheritance
All Implemented Interfaces
java.util.Iterator
Known Direct Subclasses
org.jruby.util.collections.HashMapInt.ValueIterator, org.jruby.util.collections.HashMapInt.KeyIterator, org.jruby.util.collections.HashMapInt.EntryIterator

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv HashMapInt.Entry<V>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

pack-priv HashMapInt.Entry<V>
public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

indexback to summary
pack-priv int index
nextback to summary
pack-priv HashMapInt.Entry<V> next

Constructor Detail

HashIteratorback to summary
pack-priv HashIterator()

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

nextEntryback to summary
pack-priv HashMapInt.Entry<V> nextEntry()
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

org.jruby.util.collections back to summary

private Class HashMapInt.KeyIterator

extends HashMapInt<V>.HashIterator<V>
Class Inheritance

Field Summary

Inherited from org.jruby.util.collections.HashMapInt.HashIterator:
indexnext

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public V
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

Inherited from org.jruby.util.collections.HashMapInt.HashIterator:
hasNextnextEntryremove

Constructor Detail

KeyIteratorback to summary
private KeyIterator()

Method Detail

nextback to summary
public V next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:V

the next element in the iteration

org.jruby.util.collections back to summary

private Class HashMapInt.KeySet

extends AbstractSet<V>
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Overrides java.util.AbstractCollection.clear.

Implements java.util.Set.clear, java.util.Collection.clear.

Removes all of the elements from this set (optional operation).

public boolean
contains(Object
element whose presence in this set is to be tested
o
)

Overrides java.util.AbstractCollection.contains.

Implements java.util.Set.contains, java.util.Collection.contains.

Returns true if this set contains the specified element.

public Iterator<V>
iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Set.iterator, java.util.Collection.iterator.

Returns an iterator over the elements in this set.

public boolean
remove(Object
object to be removed from this set, if present
o
)

Overrides java.util.AbstractCollection.remove.

Implements java.util.Set.remove, java.util.Collection.remove.

Removes the specified element from this set if it is present (optional operation).

public int
size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Returns the number of elements in this set (its cardinality).

Inherited from java.util.AbstractSet:
equalshashCoderemoveAll

Constructor Detail

KeySetback to summary
private KeySet()

Method Detail

clearback to summary
public void clear()

Overrides java.util.AbstractCollection.clear.

Implements java.util.Set.clear, java.util.Collection.clear.

Doc from java.util.Set.clear.

Removes all of the elements from this set (optional operation). The set will be empty after this call returns.

Annotations
@Override
containsback to summary
public boolean contains(Object o)

Overrides java.util.AbstractCollection.contains.

Implements java.util.Set.contains, java.util.Collection.contains.

Doc from java.util.Set.contains.

Returns true if this set contains the specified element. More formally, returns true if and only if this set contains an element e such that Objects.equals(o, e).

Parameters
o:Object

element whose presence in this set is to be tested

Returns:boolean

true if this set contains the specified element

Annotations
@Override
iteratorback to summary
public Iterator<V> iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Set.iterator, java.util.Collection.iterator.

Doc from java.util.Set.iterator.

Returns an iterator over the elements in this set. The elements are returned in no particular order (unless this set is an instance of some class that provides a guarantee).

Returns:Iterator<V>

an iterator over the elements in this set

removeback to summary
public boolean remove(Object o)

Overrides java.util.AbstractCollection.remove.

Implements java.util.Set.remove, java.util.Collection.remove.

Doc from java.util.Set.remove.

Removes the specified element from this set if it is present (optional operation). More formally, removes an element e such that Objects.equals(o, e), if this set contains such an element. Returns true if this set contained the element (or equivalently, if this set changed as a result of the call). (This set will not contain the element once the call returns.)

Parameters
o:Object

object to be removed from this set, if present

Returns:boolean

true if this set contained the specified element

Annotations
@Override
sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Doc from java.util.Set.size.

Returns the number of elements in this set (its cardinality). If this set contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of elements in this set (its cardinality)

org.jruby.util.collections back to summary

private final Class HashMapInt.NullMap<U>

extends HashMapInt<U>
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv static final HashMapInt.NullMap<U>
Inherited from org.jruby.util.collections.HashMapInt:
keySetvalues

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
public boolean
public int
public int
protected void
public int
Inherited from org.jruby.util.collections.HashMapInt:
clearclonecontainsValueentrySetgetEntryisEmptykeySetnewEntryIteratornewKeyIteratornewValueIteratornullMapsizetoStringvalues

Field Detail

INSTANCEback to summary
pack-priv static final HashMapInt.NullMap<U> INSTANCE

Constructor Detail

NullMapback to summary
private NullMap()

Method Detail

containsback to summary
public boolean contains(int value)

Overrides org.jruby.util.collections.HashMapInt.contains.

Annotations
@Override
containsKeyback to summary
public boolean containsKey(Object key)

Overrides org.jruby.util.collections.HashMapInt.containsKey.

Annotations
@Override
getback to summary
public int get(Object key)

Overrides org.jruby.util.collections.HashMapInt.get.

Annotations
@Override
putback to summary
public int put(Object key, int value)

Overrides org.jruby.util.collections.HashMapInt.put.

Annotations
@Override
rehashback to summary
protected void rehash()

Overrides org.jruby.util.collections.HashMapInt.rehash.

Annotations
@Override
removeback to summary
public int remove(Object key)

Overrides org.jruby.util.collections.HashMapInt.remove.

Annotations
@Override
org.jruby.util.collections back to summary

private Class HashMapInt.ValueIterator

extends HashMapInt<V>.HashIterator<Integer>
Class Inheritance

Field Summary

Inherited from org.jruby.util.collections.HashMapInt.HashIterator:
indexnext

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public Integer
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

Inherited from org.jruby.util.collections.HashMapInt.HashIterator:
hasNextnextEntryremove

Constructor Detail

ValueIteratorback to summary
private ValueIterator()

Method Detail

nextback to summary
public Integer next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:Integer

the next element in the iteration

org.jruby.util.collections back to summary

private Class HashMapInt.Values

extends AbstractCollection<Integer>
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Overrides java.util.AbstractCollection.clear.

Implements java.util.Collection.clear.

Removes all of the elements from this collection (optional operation).

public boolean
contains(Object
element whose presence in this collection is to be tested
o
)

Overrides java.util.AbstractCollection.contains.

Implements java.util.Collection.contains.

Returns true if this collection contains the specified element.

public Iterator<Integer>
iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Collection.iterator.

Returns an iterator over the elements contained in this collection.

public int
size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Collection.size.

Returns the number of elements in this collection.

Inherited from java.util.AbstractCollection:
addaddAllcontainsAllisEmptyremoveremoveAllretainAlltoArraytoArraytoString

Constructor Detail

Valuesback to summary
private Values()

Method Detail

clearback to summary
public void clear()

Overrides java.util.AbstractCollection.clear.

Implements java.util.Collection.clear.

Doc from java.util.AbstractCollection.clear.

Removes all of the elements from this collection (optional operation). The collection will be empty after this method returns.

Annotations
@Override
containsback to summary
public boolean contains(Object o)

Overrides java.util.AbstractCollection.contains.

Implements java.util.Collection.contains.

Doc from java.util.AbstractCollection.contains.

Returns true if this collection contains the specified element. More formally, returns true if and only if this collection contains at least one element e such that Objects.equals(o, e).

Parameters
o:Object

Doc from java.util.Collection.contains.

element whose presence in this collection is to be tested

Returns:boolean

Doc from java.util.Collection.contains.

true if this collection contains the specified element

Annotations
@Override
iteratorback to summary
public Iterator<Integer> iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Collection.iterator.

Doc from java.util.AbstractCollection.iterator.

Returns an iterator over the elements contained in this collection.

Returns:Iterator<Integer>

an iterator over the elements contained in this collection

sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Collection.size.

Doc from java.util.Collection.size.

Returns the number of elements in this collection. If this collection contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of elements in this collection