本文整理汇总了Java中org.apache.commons.collections15.Buffer.remove方法的典型用法代码示例。如果您正苦于以下问题:Java Buffer.remove方法的具体用法?Java Buffer.remove怎么用?Java Buffer.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.collections15.Buffer
的用法示例。
在下文中一共展示了Buffer.remove方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testBufferRemove
import org.apache.commons.collections15.Buffer; //导入方法依赖的package包/类
public void testBufferRemove() {
resetEmpty();
Buffer buffer = (Buffer) collection;
try {
buffer.remove();
fail();
} catch (UnsupportedOperationException ex) {
}
}
示例2: testRemove
import org.apache.commons.collections15.Buffer; //导入方法依赖的package包/类
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
}
}
示例3: transform
import org.apache.commons.collections15.Buffer; //导入方法依赖的package包/类
/**
* Extracts the weak components from a graph.
* @param graph the graph whose weak components are to be extracted
* @return the list of weak components
*/
public Set<Set<V>> transform(Graph<V,E> graph) {
Set<Set<V>> clusterSet = new HashSet<Set<V>>();
HashSet<V> unvisitedVertices = new HashSet<V>(graph.getVertices());
while (!unvisitedVertices.isEmpty()) {
Set<V> cluster = new HashSet<V>();
V root = unvisitedVertices.iterator().next();
unvisitedVertices.remove(root);
cluster.add(root);
Buffer<V> queue = new UnboundedFifoBuffer<V>();
queue.add(root);
while (!queue.isEmpty()) {
V currentVertex = queue.remove();
Collection<V> neighbors = graph.getNeighbors(currentVertex);
for(V neighbor : neighbors) {
if (unvisitedVertices.contains(neighbor)) {
queue.add(neighbor);
unvisitedVertices.remove(neighbor);
cluster.add(neighbor);
}
}
}
clusterSet.add(cluster);
}
return clusterSet;
}