@Override public String getString(int id) { assert id < _idToValueMap.size(); return _idToValueMap.get(id); } }
@Override public K get(final int i) { synchronized (sync) { return list.get(i); } } @Override
@Override public K get(final int i) { return list.get(i); } @Override
@Override public K previous() { if (!hasPrevious()) throw new NoSuchElementException(); return l.get(from + (last = --pos)); } @Override
@Override public K get(long index) { return list.get(intIndex(index)); } @Override
@Override public K next() { if (!hasNext()) throw new NoSuchElementException(); return l.get(from + (last = pos++)); } @Override
@Override public K get(final int index) { ensureRestrictedIndex(index); return l.get(from + index); } @Override
@Deprecated @Override public Long get(final Object o) { final CharSequence s = (CharSequence)o; final long index = function.getLong(s); return index >= 0 && index < size && list.get((int)index).equals(s) ? Long.valueOf(index) : null; }
@SuppressWarnings("unchecked") public Long get( final Object o ) { final CharSequence s = (CharSequence)o; final long index = function.getLong( s ); return index >= 0 && index < size && list.get( (int)index ).equals( s ) ? Long.valueOf( index ) : null; }
/** Creates a new shift-add-xor signed string map using a given hash map. * * @param function a function mapping each string in <code>list</code> to its ordinal position. * @param list a list of strings. */ public LiterallySignedStringMap( final Object2LongFunction<? extends CharSequence> function, final ObjectList<? extends MutableString> list ) { this.function = function; this.list = list; size = list.size(); for( int i = 0; i < size; i++ ) if ( function.getLong( list.get( i ) ) != i ) throw new IllegalArgumentException( "Function and list do not agree" ); defRetValue = -1; }
/** Creates a new shift-add-xor signed string map using a given hash map. * * @param function a function mapping each string in <code>list</code> to its ordinal position. * @param list a list of strings. */ public LiterallySignedStringMap(final Object2LongFunction<? extends CharSequence> function, final ObjectList<? extends MutableString> list) { this.function = function; this.list = list; size = list.size(); for(int i = 0; i < size; i++) if (function.getLong(list.get(i)) != i) throw new IllegalArgumentException("Function and list do not agree"); defRetValue = -1; }
/** Creates a new shift-add-xor signed string map using a given hash map. * * @param function a function mapping each string in <code>list</code> to its ordinal position. * @param list a list of strings. */ public LiterallySignedStringMap( final Object2LongFunction<? extends CharSequence> function, final ObjectList<? extends MutableString> list ) { this.function = function; this.list = list; size = list.size(); for( int i = 0; i < size; i++ ) if ( function.getLong( list.get( i ) ) != i ) throw new IllegalArgumentException( "Function and list do not agree" ); defRetValue = -1; }
@SuppressWarnings("unchecked") public Long get( final Object o ) { final CharSequence s = (CharSequence)o; final long index = function.getLong( s ); return index >= 0 && index < size && list.get( (int)index ).equals( s ) ? Long.valueOf( index ) : null; }
/** * Shuffles the specified list using the specified pseudorandom number * generator. * * @param l * the list to be shuffled. * @param random * a pseudorandom number generator. * @return {@code l}. */ public static <K> ObjectList<K> shuffle(final ObjectList<K> l, final Random random) { for (int i = l.size(); i-- != 0;) { final int p = random.nextInt(i + 1); final K t = l.get(i); l.set(i, l.get(p)); l.set(p, t); } return l; } /**
@Override public long getLong(final Object o) { final CharSequence s = (CharSequence)o; final long index = function.getLong(s); return index >= 0 && index < size && list.get((int)index).equals(s) ? index : defRetValue; }
@SuppressWarnings("unchecked") public long getLong( final Object o ) { final CharSequence s = (CharSequence)o; final long index = function.getLong( s ); return index >= 0 && index < size && list.get( (int)index ).equals( s ) ? index : defRetValue; }
@SuppressWarnings("unchecked") public long getLong( final Object o ) { final CharSequence s = (CharSequence)o; final long index = function.getLong( s ); return index >= 0 && index < size && list.get( (int)index ).equals( s ) ? index : defRetValue; }
new MutableString( termMap.list().get( inputStream.readInt() ) ).writeSelfDelimUTF8( (OutputStream)outputStream ); outputStream.flush(); break;
new MutableString( termMap.list().get( inputStream.readInt() ) ).writeSelfDelimUTF8( (OutputStream)outputStream ); outputStream.flush(); break;
new MutableString( prefixMap.list().get( inputStream.readInt() ) ).writeSelfDelimUTF8( (OutputStream)outputStream ); outputStream.flush(); break;