Top Inners Fields Constructors Methods
org.jcodings.util

public abstract Class Hash<V>

extends Object
implements Iterable<V>
Class Inheritance
All Implemented Interfaces
java.lang.Iterable
Known Direct Subclasses
org.jcodings.util.IntArrayHash, org.jcodings.util.IntHash, org.jcodings.util.ObjHash, org.jcodings.util.BytesHash, org.jcodings.util.CaseInsensitiveBytesHash
Imports
java.util.Iterator, org.jcodings.exception.InternalException

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public class
public class

Field Summary

Modifier and TypeField and Description
private static final int
protected Hash.HashEntry<V>
private static final int
private static final int
private static final int
private static final int[]
protected int
protected Hash.HashEntry<V>[]

Constructor Summary

AccessConstructor and Description
public
Hash()

public
Hash(int size)

Method Summary

Modifier and TypeMethod and Description
protected static int
bucketIndex(final int h, final int length)

protected final void
public Hash<V>.HashEntryIterator
protected static int
hashValue(int h)

protected abstract void
init()

public Iterator<V>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.
protected final void
resize(int newCapacity)

public final int
size()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

HASH_SIGN_BIT_MASKback to summary
private static final int HASH_SIGN_BIT_MASK
INITIAL_CAPACITYback to summary
private static final int INITIAL_CAPACITY
MAXIMUM_CAPACITYback to summary
private static final int MAXIMUM_CAPACITY
MIN_CAPAback to summary
private static final int MIN_CAPA
PRIMESback to summary
private static final int[] PRIMES
sizeback to summary
protected int size
tableback to summary
protected Hash.HashEntry<V>[] table

Constructor Detail

Hashback to summary
public Hash()
Hashback to summary
public Hash(int size)

Method Detail

bucketIndexback to summary
protected static int bucketIndex(final int h, final int length)
checkResizeback to summary
protected final void checkResize()
entryIteratorback to summary
public Hash<V>.HashEntryIterator entryIterator()
hashValueback to summary
protected static int hashValue(int h)
initback to summary
protected abstract void init()
iteratorback to summary
public Iterator<V> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<V>

an Iterator.

resizeback to summary
protected final void resize(int newCapacity)
sizeback to summary
public final int size()
org.jcodings.util back to summary

public Class Hash.HashEntry<V>

extends Object
Class Inheritance
Known Direct Subclasses
org.jcodings.util.IntArrayHash.IntArrayHashEntry, org.jcodings.util.IntHash.IntHashEntry, org.jcodings.util.ObjHash.ObjHashEntry, org.jcodings.util.BytesHash.BytesHashEntry, org.jcodings.util.CaseInsensitiveBytesHash.CaseInsensitiveBytesHashEntry

Field Summary

Modifier and TypeField and Description
protected Hash.HashEntry<V>
protected Hash.HashEntry<V>
pack-priv final int
protected Hash.HashEntry<V>
public V

Constructor Summary

AccessConstructor and Description
pack-priv
HashEntry(int hash, Hash.HashEntry<V> next, V value, Hash.HashEntry<V> head)

pack-priv

Method Summary

Modifier and TypeMethod and Description
public int
pack-priv void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

afterback to summary
protected Hash.HashEntry<V> after
beforeback to summary
protected Hash.HashEntry<V> before
hashback to summary
pack-priv final int hash
nextback to summary
protected Hash.HashEntry<V> next
valueback to summary
public V value

Constructor Detail

HashEntryback to summary
pack-priv HashEntry(int hash, Hash.HashEntry<V> next, V value, Hash.HashEntry<V> head)
HashEntryback to summary
pack-priv HashEntry()

Method Detail

getHashback to summary
public int getHash()
removeback to summary
pack-priv void remove()
org.jcodings.util back to summary

public Class Hash.HashEntryIterator

extends Object
implements Iterator<Hash.HashEntry<V>>, Iterable<Hash.HashEntry<V>>
Class Inheritance
All Implemented Interfaces
java.lang.Iterable, java.util.Iterator
Known Direct Subclasses
org.jcodings.util.CaseInsensitiveBytesHash.CaseInsensitiveBytesHashEntryIterator

Field Summary

Modifier and TypeField and Description
pack-priv Hash.HashEntry<V>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.
public Iterator<Hash.HashEntry<V>>
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.
public Hash.HashEntry<V>
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.
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

nextback to summary
pack-priv Hash.HashEntry<V> next

Constructor Detail

HashEntryIteratorback to summary
public HashEntryIterator()

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

iteratorback to summary
public Iterator<Hash.HashEntry<V>> iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:Iterator<Hash.HashEntry<V>>

an Iterator.

nextback to summary
public Hash.HashEntry<V> next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:Hash.HashEntry<V>

the next element in the iteration

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.jcodings.util back to summary

public Class Hash.HashIterator

extends Object
implements Iterator<V>
Class Inheritance
All Implemented Interfaces
java.util.Iterator

Field Summary

Modifier and TypeField and Description
pack-priv Hash.HashEntry<V>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.
public V
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.
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

nextback to summary
pack-priv Hash.HashEntry<V> next

Constructor Detail

HashIteratorback to summary
public 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

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

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.