Code example for ByteBuffer

Methods: asReadOnlyBuffer, compareTo

0
    return buffer.getInt(buffer.position() + (index * 4));
  } 
 
  public ByteBuffer getBuffer()
  { 
    return buffer.asReadOnlyBuffer();
  } 
 
  @Override 
  public int compareTo(IntBufferIndexedInts o)
  { 
    return buffer.compareTo(o.getBuffer());
  } 
 
  @Override 
  public Iterator<Integer> iterator()
  { 
    return new IndexedIntsIterator(this);
  } 
 
  private static class IntBufferIndexedIntsObjectStrategy implements ObjectStrategy<IntBufferIndexedInts>