本文整理汇总了Java中java.util.LinkedList.pollLast方法的典型用法代码示例。如果您正苦于以下问题:Java LinkedList.pollLast方法的具体用法?Java LinkedList.pollLast怎么用?Java LinkedList.pollLast使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.LinkedList
的用法示例。
在下文中一共展示了LinkedList.pollLast方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: closeUnused
import java.util.LinkedList; //导入方法依赖的package包/类
private void closeUnused ()
{
final int instances = this.usedPool.size () + this.freePool.size ();
int num = instances - this.instanceCountTarget;
if ( num <= 0 )
{
return;
}
logger.debug ( "Trying to reduce by {}", num );
final LinkedList<AccessorWrapper> entries = new LinkedList<AccessorWrapper> ( this.freePool.values () );
// sort by access date
Collections.sort ( entries, new Comparator<AccessorWrapper> () {
@Override
public int compare ( final AccessorWrapper o1, final AccessorWrapper o2 )
{
return o1.getLastAccess ().compareTo ( o2.getLastAccess () );
}
} );
while ( !this.freePool.isEmpty () && !entries.isEmpty () && num > 0 )
{
final AccessorWrapper entry = entries.pollLast ();
logger.debug ( "Removing {} from pool", entry.getFile () );
this.freePool.remove ( entry.getFile () );
entry.getTarget ().dispose ();
num--;
}
}
示例2: deleteContent
import java.util.LinkedList; //导入方法依赖的package包/类
private static void deleteContent(File file){
LinkedList<File> themeLinkedList=new LinkedList<File>();
if (file.isDirectory()) {
themeLinkedList.addAll(Arrays.asList(file.listFiles()));
while (!themeLinkedList.isEmpty()) {
File subFile=themeLinkedList.pollLast();
deleteContent(subFile);
}
}
file.delete();
}
示例3: transferThroughList
import java.util.LinkedList; //导入方法依赖的package包/类
private String transferThroughList(String in, int index) {
LinkedList<String> list = new LinkedList<String>();
list.add(System.getenv("")); // taints the list
list.clear(); // makes the list safe again
list.add(1, "xx");
list.addFirst(in); // can taint the list
list.addLast("yy");
list.push(in);
return list.element() + list.get(index) + list.getFirst() + list.getLast()
+ list.peek() + list.peekFirst() + list.peekLast() + list.poll()
+ list.pollFirst() + list.pollLast() + list.pop() + list.remove()
+ list.remove(index) + list.removeFirst() + list.removeLast()
+ list.set(index, "safe") + list.toString();
}