本文整理匯總了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();
}