Java LongBuffer.duplicate()

Syntax

LongBuffer.duplicate() has the following syntax.

public abstract LongBuffer duplicate()

Example

In the following code shows how to use LongBuffer.duplicate() method.


import java.nio.LongBuffer;
import java.util.Arrays;
//from   w w w.  j a v  a2  s . c  om
public class Main {
  public static void main(String[] args) {
    LongBuffer longBuffer = LongBuffer.allocate(10);
    longBuffer.put(100);
    
    longBuffer.rewind();
    
    
    LongBuffer longBuffer2 = longBuffer.duplicate();
    
    System.out.println(longBuffer2.equals(longBuffer2));

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.nio »




Buffer
ByteBuffer
ByteOrder
CharBuffer
DoubleBuffer
FloatBuffer
IntBuffer
LongBuffer
MappedByteBuffer
ShortBuffer