本文整理了Java中org.apache.commons.collections.Buffer.remove()
方法的一些代码示例,展示了Buffer.remove()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Buffer.remove()
方法的具体详情如下:
包路径:org.apache.commons.collections.Buffer
类名称:Buffer
方法名:remove
[英]Gets and removes the next object from the buffer.
[中]获取并从缓冲区中删除下一个对象。
代码示例来源:origin: commons-collections/commons-collections
public Object remove() {
synchronized (lock) {
Object returnValue = getBuffer().remove();
lock.notifyAll();
return returnValue;
}
}
代码示例来源:origin: commons-collections/commons-collections
public Object remove() {
synchronized (lock) {
return getBuffer().remove();
}
}
代码示例来源:origin: commons-collections/commons-collections
public Object remove() {
return getBuffer().remove();
}
代码示例来源:origin: wildfly/wildfly
public Object remove() {
synchronized (lock) {
return getBuffer().remove();
}
}
代码示例来源:origin: commons-collections/commons-collections
public Object remove() {
return getBuffer().remove();
}
代码示例来源:origin: commons-collections/commons-collections
public Object remove() {
return getBuffer().remove();
}
代码示例来源:origin: wildfly/wildfly
public Object remove() {
synchronized (lock) {
Object returnValue = getBuffer().remove();
lock.notifyAll();
return returnValue;
}
}
代码示例来源:origin: wildfly/wildfly
public Object remove() {
return getBuffer().remove();
}
代码示例来源:origin: wildfly/wildfly
public Object remove() {
return getBuffer().remove();
}
代码示例来源:origin: wildfly/wildfly
public Object remove() {
return getBuffer().remove();
}
代码示例来源:origin: commons-collections/commons-collections
public void run() {
try {
Thread.sleep(delay);
for (int i = 0; i < nToRemove; ++i) {
buffer.remove();
}
} catch (InterruptedException e) {
}
}
}
代码示例来源:origin: commons-collections/commons-collections
public void testRemove() {
Buffer buffer = makeTestBuffer();
buffer.add("one");
assertEquals("Buffer get", buffer.remove(), "one");
try {
buffer.remove();
fail("Expecting BufferUnderflowException");
} catch (BufferUnderflowException ex) {
// expected
}
}
代码示例来源:origin: commons-collections/commons-collections
public void testBufferRemove() {
resetEmpty();
Buffer buffer = (Buffer) collection;
try {
buffer.remove();
fail();
} catch (UnsupportedOperationException ex) {}
}
代码示例来源:origin: commons-collections/commons-collections
public void testRemoveWithAddTimeout() {
Buffer blockingBuffer = BlockingBuffer.decorate( new MyBuffer(), 100 );
Object obj = new Object();
new DelayedAdd( blockingBuffer, obj, 500 ).start();
try {
blockingBuffer.remove();
}
catch( BufferUnderflowException e ) {
}
}
//-----------------------------------------------------------------------
代码示例来源:origin: commons-collections/commons-collections
public void testRemoveWithAddAllTimeout() {
Buffer blockingBuffer = BlockingBuffer.decorate( new MyBuffer(), 100 );
Object obj = new Object();
new DelayedAddAll( blockingBuffer, obj, 500 ).start();
try {
blockingBuffer.remove();
}
catch( BufferUnderflowException e ) {
}
}
//-----------------------------------------------------------------------
代码示例来源:origin: commons-collections/commons-collections
/**
* Tests {@link BlockingBuffer#remove()} in combination with {@link BlockingBuffer#addAll(java.util.Collection)}.
*/
public void testRemoveWithAddAll() {
Buffer blockingBuffer = BlockingBuffer.decorate( new MyBuffer() );
Object obj = new Object();
new DelayedAddAll( blockingBuffer, obj ).start();
// verify does not throw BufferUnderflowException; should block until other thread has added to the buffer .
assertSame( obj, blockingBuffer.remove() );
}
代码示例来源:origin: commons-collections/commons-collections
/**
* Tests {@link BlockingBuffer#remove()} in combination with {@link BlockingBuffer#add(Object)}.
*/
public void testRemoveWithAdd() {
Buffer blockingBuffer = BlockingBuffer.decorate( new MyBuffer() );
Object obj = new Object();
new DelayedAdd( blockingBuffer, obj ).start();
// verify does not throw BufferUnderflowException; should block until other thread has added to the buffer .
assertSame( obj, blockingBuffer.remove() );
}
代码示例来源:origin: commons-collections/commons-collections
public void testAddAllToFullBufferRemoveViaIterator() {
final Buffer bounded = BoundedBuffer.decorate(new UnboundedFifoBuffer(), 2, 500);
bounded.add( "Hello" );
bounded.add( "World" );
new DelayedIteratorRemove( bounded, 200, 2 ).start();
bounded.addAll( Arrays.asList( new String[] { "Foo", "Bar" } ) );
assertEquals( 2, bounded.size() );
assertEquals( "Foo", bounded.remove() );
assertEquals( "Bar", bounded.remove() );
}
代码示例来源:origin: commons-collections/commons-collections
public void testTransformedBuffer() {
Buffer buffer = TransformedBuffer.decorate(new ArrayStack(), TestTransformedCollection.STRING_TO_INTEGER_TRANSFORMER);
assertEquals(0, buffer.size());
Object[] els = new Object[] {"1", "3", "5", "7", "2", "4", "6"};
for (int i = 0; i < els.length; i++) {
buffer.add(els[i]);
assertEquals(i + 1, buffer.size());
assertEquals(true, buffer.contains(new Integer((String) els[i])));
assertEquals(false, buffer.contains(els[i]));
}
assertEquals(false, buffer.remove(els[0]));
assertEquals(true, buffer.remove(new Integer((String) els[0])));
}
}
代码示例来源:origin: commons-collections/commons-collections
public void testBufferEmpty() {
resetEmpty();
Buffer buffer = (Buffer) collection;
assertEquals(0, buffer.size());
assertEquals(true, buffer.isEmpty());
try {
buffer.get();
fail();
} catch (BufferUnderflowException ex) {}
try {
buffer.remove();
fail();
} catch (BufferUnderflowException ex) {}
}
内容来源于网络,如有侵权,请联系作者删除!