/** {@inheritDoc} */ public int[] keys() { int[] keys = new int[size()]; int[] k = _set; byte[] states = _states; for ( int i = k.length, j = 0; i-- > 0; ) { if ( states[i] == FULL ) { keys[j++] = k[i]; } } return keys; }
/** {@inheritDoc} */ public byte[] values() { byte[] vals = new byte[size()]; byte[] v = _values; byte[] states = _states; for ( int i = v.length, j = 0; i-- > 0; ) { if ( states[i] == FULL ) { vals[j++] = v[i]; } } return vals; }
/** {@inheritDoc} */ public byte[] values( byte[] array ) { int size = size(); if ( array.length < size ) { array = new byte[size]; } byte[] v = _values; byte[] states = _states; for ( int i = v.length, j = 0; i-- > 0; ) { if ( states[i] == FULL ) { array[j++] = v[i]; } } return array; }
/** {@inheritDoc} */ public int[] keys( int[] array ) { int size = size(); if ( array.length < size ) { array = new int[size]; } int[] keys = _set; byte[] states = _states; for ( int i = keys.length, j = 0; i-- > 0; ) { if ( states[i] == FULL ) { array[j++] = keys[i]; } } return array; }
/** {@inheritDoc} */ @Override public boolean equals( Object other ) { if ( ! ( other instanceof TIntByteMap ) ) { return false; } TIntByteMap that = ( TIntByteMap ) other; if ( that.size() != this.size() ) { return false; } byte[] values = _values; byte[] states = _states; byte this_no_entry_value = getNoEntryValue(); byte that_no_entry_value = that.getNoEntryValue(); for ( int i = values.length; i-- > 0; ) { if ( states[i] == FULL ) { int key = _set[i]; byte that_value = that.get( key ); byte this_value = values[i]; if ( ( this_value != that_value ) && ( this_value != this_no_entry_value ) && ( that_value != that_no_entry_value ) ) { return false; } } } return true; }
/** {@inheritDoc} */ public byte[] values() { byte[] vals = new byte[size()]; byte[] v = _values; byte[] states = _states; for ( int i = v.length, j = 0; i-- > 0; ) { if ( states[i] == FULL ) { vals[j++] = v[i]; } } return vals; }
/** {@inheritDoc} */ public int[] keys() { int[] keys = new int[size()]; int[] k = _set; byte[] states = _states; for ( int i = k.length, j = 0; i-- > 0; ) { if ( states[i] == FULL ) { keys[j++] = k[i]; } } return keys; }
/** {@inheritDoc} */ public int[] keys() { int[] keys = new int[size()]; int[] k = _set; byte[] states = _states; for ( int i = k.length, j = 0; i-- > 0; ) { if ( states[i] == FULL ) { keys[j++] = k[i]; } } return keys; }
/** {@inheritDoc} */ public byte[] values() { byte[] vals = new byte[size()]; byte[] v = _values; byte[] states = _states; for ( int i = v.length, j = 0; i-- > 0; ) { if ( states[i] == FULL ) { vals[j++] = v[i]; } } return vals; }
/** {@inheritDoc} */ @Override public byte[] values() { byte[] vals = new byte[size()]; byte[] v = _values; byte[] states = _states; for ( int i = v.length, j = 0; i-- > 0; ) { if ( states[i] == FULL ) { vals[j++] = v[i]; } } return vals; }
@Override public int used() { return data.size(); }
/** {@inheritDoc} */ @Override public int[] keys() { int[] keys = new int[size()]; int[] k = _set; byte[] states = _states; for ( int i = k.length, j = 0; i-- > 0; ) { if ( states[i] == FULL ) { keys[j++] = k[i]; } } return keys; }
/** {@inheritDoc} */ public int[] keys( int[] array ) { int size = size(); if ( array.length < size ) { array = new int[size]; } int[] keys = _set; byte[] states = _states; for ( int i = keys.length, j = 0; i-- > 0; ) { if ( states[i] == FULL ) { array[j++] = keys[i]; } } return array; }
/** {@inheritDoc} */ public byte[] values( byte[] array ) { int size = size(); if ( array.length < size ) { array = new byte[size]; } byte[] v = _values; byte[] states = _states; for ( int i = v.length, j = 0; i-- > 0; ) { if ( states[i] == FULL ) { array[j++] = v[i]; } } return array; }
/** {@inheritDoc} */ public int[] keys() { int[] keys = new int[size()]; if ( keys.length == 0 ) { return keys; // nothing to copy } int[] k = _set; byte[] states = _states; for ( int i = k.length, j = 0; i-- > 0; ) { if ( states[i] == FULL ) { keys[j++] = k[i]; } } return keys; }
/** {@inheritDoc} */ public byte[] values() { byte[] vals = new byte[size()]; if ( vals.length == 0 ) { return vals; // nothing to copy } byte[] v = _values; byte[] states = _states; for ( int i = v.length, j = 0; i-- > 0; ) { if ( states[i] == FULL ) { vals[j++] = v[i]; } } return vals; }
/** {@inheritDoc} */ public int[] keys( int[] array ) { int size = size(); if ( array.length < size ) { array = new int[size]; } int[] keys = _set; byte[] states = _states; for ( int i = keys.length, j = 0; i-- > 0; ) { if ( states[i] == FULL ) { array[j++] = keys[i]; } } return array; }
/** {@inheritDoc} */ public byte[] values( byte[] array ) { int size = size(); if ( array.length < size ) { array = new byte[size]; } byte[] v = _values; byte[] states = _states; for ( int i = v.length, j = 0; i-- > 0; ) { if ( states[i] == FULL ) { array[j++] = v[i]; } } return array; }
/** {@inheritDoc} */ @Override public int[] keys( int[] array ) { int size = size(); if ( array.length < size ) { array = new int[size]; } int[] keys = _set; byte[] states = _states; for ( int i = keys.length, j = 0; i-- > 0; ) { if ( states[i] == FULL ) { array[j++] = keys[i]; } } return array; }
@Override public SparseByteArray reverse() { //TODO: this could be more efficient and avoid the copy TIntByteHashMap tmp = new TIntByteHashMap(data.size()); for (Entry e : entries()) tmp.put(length - e.index, e.value); this.data = tmp; return this; } }