本文整理了Java中java.util.LinkedList.getLast()
方法的一些代码示例,展示了LinkedList.getLast()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LinkedList.getLast()
方法的具体详情如下:
包路径:java.util.LinkedList
类名称:LinkedList
方法名:getLast
[英]Returns the last element in this list.
[中]返回此列表中的最后一个元素。
代码示例来源:origin: spring-projects/spring-framework
@SuppressWarnings("unchecked")
@Nullable
private <T> T getLastBuilder(Class<T> builderClass) {
if (!this.builders.isEmpty()) {
PathComponentBuilder last = this.builders.getLast();
if (builderClass.isInstance(last)) {
return (T) last;
}
}
return null;
}
代码示例来源:origin: org.codehaus.groovy/groovy
public void popLHS() {
lhsStack.removeLast();
this.lhs = lhsStack.getLast();
}
代码示例来源:origin: apache/rocketmq
private void printStats() {
if (snapshotList.size() >= 10) {
Long[] begin = snapshotList.getFirst();
Long[] end = snapshotList.getLast();
final long sendTps = (long) (((end[3] - begin[3]) / (double) (end[0] - begin[0])) * 1000L);
final double averageRT = (end[5] - begin[5]) / (double) (end[3] - begin[3]);
System.out.printf("Send TPS: %d Max RT: %d Average RT: %7.3f Send Failed: %d Response Failed: %d%n",
sendTps, statsBenchmark.getSendMessageMaxRT().get(), averageRT, end[2], end[4]);
}
}
代码示例来源:origin: org.springframework.boot/spring-boot
private static List<Configurations> collate(
List<Configurations> orderedConfigurations) {
LinkedList<Configurations> collated = new LinkedList<>();
for (Configurations item : orderedConfigurations) {
if (collated.isEmpty() || collated.getLast().getClass() != item.getClass()) {
collated.add(item);
}
else {
collated.set(collated.size() - 1, collated.getLast().merge(item));
}
}
return collated;
}
代码示例来源:origin: fesh0r/fernflower
private static void addToReversePostOrderListIterative(DirectNode root, List<DirectNode> lst) {
LinkedList<DirectNode> stackNode = new LinkedList<>();
LinkedList<Integer> stackIndex = new LinkedList<>();
HashSet<DirectNode> setVisited = new HashSet<>();
stackNode.add(root);
stackIndex.add(0);
while (!stackNode.isEmpty()) {
DirectNode node = stackNode.getLast();
int index = stackIndex.removeLast();
setVisited.add(node);
for (; index < node.succs.size(); index++) {
DirectNode succ = node.succs.get(index);
if (!setVisited.contains(succ)) {
stackIndex.add(index + 1);
stackNode.add(succ);
stackIndex.add(0);
break;
}
}
if (index == node.succs.size()) {
lst.add(0, node);
stackNode.removeLast();
}
}
}
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
if (list.size() > 0 && !list.getLast().equals("..")) {
list.removeLast();
} else {
list.add("..");
Logger.getLogger(AssetKey.class.getName()).log(Level.SEVERE, "Asset path \"{0}\" is outside assetmanager root", path);
list.add(string);
for (int i = 0; i < list.size(); i++) {
String string = list.get(i);
if (i != 0) {
代码示例来源:origin: Sable/soot
/** Decide whether this tag should be aggregated by this aggregator. */
@Override
public void considerTag(Tag t, Unit u, LinkedList<Tag> tags, LinkedList<Unit> units) {
if (units.size() > 0 && units.getLast() == u) {
return;
}
units.add(u);
tags.add(t);
}
}
代码示例来源:origin: stanfordnlp/CoreNLP
boolean addedBe = false;
boolean addedSuffix = false;
if (body.size() > 1 && !"PRP".equals(body.get(0).tag())) {
for (int i = 2; i < body.size(); ++i) {
CoreLabel tokI = body.get(i);
if (tokI.tag() != null &&
(tokI.tag().startsWith("D") && suffix != null) ||
(tokI.tag().startsWith("R") && suffix != null))) {
body.add(i, be.get(0));
i += 1;
if (suffix != null) {
while (i < body.size() && body.get(i).tag() != null &&
(body.get(i).tag().startsWith("J") || body.get(i).tag().startsWith("V") || body.get(i).tag().startsWith("R") ||
body.get(i).tag().startsWith("N") || body.get(i).tag().startsWith("D")) &&
i += 1;
body.add(i, suffix.get(0));
addedSuffix = true;
body.add(prepNum.get(0));
body.add(WORD_IN);
body.add(prepNum.get(1));
if (beIter.hasNext() && body.getLast() == beIter.next()) {
body.removeLast();
代码示例来源:origin: org.codehaus.groovy/groovy
private void addVariablesToStack(Parameter[] params) {
Set<String> names = new HashSet<String>(varStack.getLast());
for (Parameter param : params) {
names.add(param.getName());
}
varStack.add(names);
}
代码示例来源:origin: stanfordnlp/CoreNLP
while (!preTerms.isEmpty() && isPunc(preTerms.getFirst())) {
newChildren.add(preTerms.getFirst());
preTerms.removeFirst();
LinkedList<Tree> temp = new LinkedList<>();
if (newChild.children().length > 0) {
newChildren.add(newChild);
while (!preTerms.isEmpty() && isPunc(preTerms.getLast())) {
temp.addFirst(preTerms.getLast());
preTerms.removeLast();
while (!newChildren.isEmpty() && isPunc(newChildren.getFirst())) {
newChildren.removeFirst();
while (!newChildren.isEmpty() && isPunc(newChildren.getLast())) {
newChildren.removeLast();
代码示例来源:origin: gchq/Gaffer
public Builder edge(final Edge edge) {
if (entities.isEmpty()) {
entities.add(new AbstractMap.SimpleEntry<>(edge.getMatchedVertexValue(), Sets.newHashSet()));
} else {
verifyEdge(entities.getLast().getKey(), edge);
}
edges.add(Sets.newHashSet(edge));
entities.add(new AbstractMap.SimpleEntry<>(edge.getAdjacentMatchedVertexValue(), Sets.newHashSet()));
return this;
}
代码示例来源:origin: ankidroid/Anki-Android
/** Undo menu item name, or "" if undo unavailable. */
public String undoName(Resources res) {
if (mUndo.size() > 0) {
DismissType type = (DismissType) mUndo.getLast()[0];
return res.getString(type.undoNameId);
}
return "";
}
代码示例来源:origin: apache/incubator-dubbo
Integer old = index;
if (index == null) {
index = history.size() - 1;
} else {
if (up) {
index = index - 1;
if (index < 0) {
index = history.size() - 1;
if (index > history.size() - 1) {
index = 0;
channel.setAttribute(HISTORY_LIST_KEY, history);
if (history.isEmpty()) {
history.addLast(result);
} else if (!result.equals(history.getLast())) {
history.remove(result);
history.addLast(result);
代码示例来源:origin: Sable/soot
indexStack.addLast(-1);
while (!stmtStack.isEmpty()) {
int toVisitIndex = indexStack.removeLast();
N toVisitNode = stmtStack.getLast();
代码示例来源:origin: org.apache.poi/poi-ooxml
Segment lastSegment = segments.getLast();
if (lastSegment.end == upperbound - 1) {
lastSegment.end = upperbound;
return false;
} else {
segments.add(new Segment(upperbound, upperbound));
return true;
Segment firstSegment = segments.getFirst();
if (firstSegment.start == lowerbound + 1) {
firstSegment.start = lowerbound;
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
void setText(final String text) {
colorTags.setText(text);
plainText = colorTags.getPlainText();
head.setNext(tail);
tail.setPrevious(head);
current = head;
if (text != null && plainText.length() > 0) {
LetterQuad l = head;
for (int i = 0; i < plainText.length(); i++) {
l = l.addNextCharacter(plainText.charAt(i));
if (baseColor != null) {
// Give the letter a default color if
// one has been provided.
l.setColor( baseColor );
}
}
}
LinkedList<Range> ranges = colorTags.getTags();
if (!ranges.isEmpty()) {
for (int i = 0; i < ranges.size()-1; i++) {
Range start = ranges.get(i);
Range end = ranges.get(i+1);
setColor(start.start, end.start, start.color);
}
Range end = ranges.getLast();
setColor(end.start, plainText.length(), end.color);
}
invalidate();
}
代码示例来源:origin: hibernate/hibernate-orm
private void closeExpression(QueryTranslatorImpl q, String lcToken) {
if ( booleanTests.removeLast() ) { //it was a boolean expression
if ( booleanTests.size() > 0 ) {
// the next one up must also be
booleanTests.removeLast();
booleanTests.addLast( Boolean.TRUE );
}
// Add any joins
appendToken( q, ( joins.removeLast() ).toString() );
}
else {
StringBuilder join = joins.removeLast();
joins.getLast().append( join.toString() );
}
if ( nots.removeLast() ) {
negated = !negated;
}
if ( !")".equals( lcToken ) ) {
appendToken( q, ")" );
}
}
代码示例来源:origin: spotbugs/spotbugs
Edge last = partialPath.getLast();
partialPath.add(outEdge);
work(partialPath);
partialPath.removeLast();
代码示例来源:origin: fesh0r/fernflower
if (stack.isEmpty()) { // first line, root node
stack.push(matchNode);
stack.getFirst().addChild(matchNode);
stack.push(matchNode);
this.rootNode = stack.getLast();
代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit
/**
* Copy all entries which are still in untrackedParentFolders and which
* belong to a path this treewalk has left into untrackedFolders. It is sure
* that we will not find any tracked files underneath these paths. Therefore
* these paths definitely belong to untracked folders.
*
* @param currentPath
* the current path of the treewalk
*/
private void copyUntrackedFolders(String currentPath) {
String pathToBeSaved = null;
while (!untrackedParentFolders.isEmpty()
&& !currentPath.startsWith(untrackedParentFolders.getFirst()
+ "/")) //$NON-NLS-1$
pathToBeSaved = untrackedParentFolders.removeFirst();
if (pathToBeSaved != null) {
while (!untrackedFolders.isEmpty()
&& untrackedFolders.getLast().startsWith(pathToBeSaved))
untrackedFolders.removeLast();
untrackedFolders.addLast(pathToBeSaved);
}
}
内容来源于网络,如有侵权,请联系作者删除!