本文整理匯總了Java中java.util.LinkedList.peekLast方法的典型用法代碼示例。如果您正苦於以下問題:Java LinkedList.peekLast方法的具體用法?Java LinkedList.peekLast怎麽用?Java LinkedList.peekLast使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.LinkedList
的用法示例。
在下文中一共展示了LinkedList.peekLast方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: adjustEndGlyphs
import java.util.LinkedList; //導入方法依賴的package包/類
private void adjustEndGlyphs(LinkedList<GSLayoutGlyph> glyphs) {
// Compress last none CRLF glyph if possible
GSLayoutGlyph lastGlyph = glyphs.getLast();
GSLayoutGlyph crlfGlyph = null;
if (GSCharUtils.isNewline(lastGlyph.code()) && glyphs.size() > 1) {
crlfGlyph = lastGlyph;
glyphs.removeLast();
lastGlyph = glyphs.peekLast();
}
if (GSCharUtils.shouldCompressEnd(lastGlyph) && GSCharUtils.canCompress(lastGlyph)) {
lastGlyph.compressEnd = lastGlyph.size * builder.punctuationCompressRate;
}
if (lastGlyph.code() == ' ') {
lastGlyph.compressEnd = lastGlyph.size;
}
if (crlfGlyph != null) {
if (builder.vertical) {
crlfGlyph.y = lastGlyph.getUsedEndSize();
} else {
crlfGlyph.x = lastGlyph.getUsedEndSize();
}
glyphs.addLast(crlfGlyph);
}
}
示例2: adjustTts
import java.util.LinkedList; //導入方法依賴的package包/類
static List<TimeToSampleBox.Entry> adjustTts(List<TimeToSampleBox.Entry> source, double timeScaleFactor, long[] syncSample, long[] syncSampleTimes) {
long[] sourceArray = TimeToSampleBox.blowupTimeToSamples(source);
long summedDurations = 0;
LinkedList<TimeToSampleBox.Entry> entries2 = new LinkedList<TimeToSampleBox.Entry>();
for (int i = 1; i <= sourceArray.length; i++) {
long duration = sourceArray[i - 1];
long x = Math.round(timeScaleFactor * duration);
TimeToSampleBox.Entry last = entries2.peekLast();
int ssIndex;
if ((ssIndex = Arrays.binarySearch(syncSample, i + 1)) >= 0) {
// we are at the sample before sync point
if (syncSampleTimes[ssIndex] != summedDurations) {
long correction = syncSampleTimes[ssIndex] - (summedDurations + x);
LOG.finest(String.format("Sample %d %d / %d - correct by %d", i, summedDurations, syncSampleTimes[ssIndex], correction));
x += correction;
}
}
summedDurations += x;
if (last == null) {
entries2.add(new TimeToSampleBox.Entry(1, x));
} else if (last.getDelta() != x) {
entries2.add(new TimeToSampleBox.Entry(1, x));
} else {
last.setCount(last.getCount() + 1);
}
}
return entries2;
}
示例3: getSkillEvasionTypeValue
import java.util.LinkedList; //導入方法依賴的package包/類
public double getSkillEvasionTypeValue(int magicType)
{
final LinkedList<Double> skillEvasions = _skillEvasionStat.get(magicType);
if ((skillEvasions != null) && !skillEvasions.isEmpty())
{
return skillEvasions.peekLast();
}
return 0d;
}
示例4: 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();
}
示例5: cacheAncestors
import java.util.LinkedList; //導入方法依賴的package包/類
/**
* Does a 'breadth first' search of ancestors, caching as it goes
* @param nodeIds initial list of nodes to visit
* @return all visited nodes, in no particular order
*/
private List<Long> cacheAncestors(List<Long> nodeIds)
{
final LinkedList<Long> toVisit = new LinkedList<Long>(nodeIds);
Set<Long> visited = new TreeSet<Long>();
Long nodeId;
nodeDAO.cacheNodesById(toVisit);
Long lastCached = toVisit.peekLast();
while ((nodeId = toVisit.pollFirst()) != null)
{
if (visited.add(nodeId) && (nodeDAO.getNodeIdStatus(nodeId) != null) && (false == nodeDAO.getNodeIdStatus(nodeId).isDeleted()))
{
nodeDAO.getParentAssocs(nodeId, null, null, null, new ChildAssocRefQueryCallback()
{
@Override
public boolean preLoadNodes()
{
return false;
}
@Override
public boolean orderResults()
{
return false;
}
@Override
public boolean handle(Pair<Long, ChildAssociationRef> childAssocPair,
Pair<Long, NodeRef> parentNodePair, Pair<Long, NodeRef> childNodePair)
{
toVisit.add(parentNodePair.getFirst());
return true;
}
@Override
public void done()
{
}
});
}
final boolean nodeIdEqualsLastCached = (nodeId == null && lastCached == null) ||
(nodeId != null && nodeId.equals(lastCached));
if (nodeIdEqualsLastCached && !toVisit.isEmpty())
{
nodeDAO.cacheNodesById(toVisit);
lastCached = toVisit.peekLast();
}
}
return new ArrayList<Long>(visited);
}