当前位置: 首页>>代码示例>>Java>>正文


Java LinkedList.removeLast方法代码示例

本文整理汇总了Java中java.util.LinkedList.removeLast方法的典型用法代码示例。如果您正苦于以下问题:Java LinkedList.removeLast方法的具体用法?Java LinkedList.removeLast怎么用?Java LinkedList.removeLast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.LinkedList的用法示例。


在下文中一共展示了LinkedList.removeLast方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
    }
}
 
开发者ID:geansea,项目名称:GSLayout,代码行数:25,代码来源:GSLayout.java

示例2: save

import java.util.LinkedList; //导入方法依赖的package包/类
private void save(Object entity, LinkedList<Object> context) {
    if(entity == null) return;

    context.addLast(entity);

    EventContainer.addEvent(new Event.SaveEvent(Event.EventType.SAVE, entity));

    Collection<Object> cascadeEntity = getCascadeEntity(entity, context);
    cascadeEntity.forEach((e) -> {
        if(e instanceof Iterable) {
            save((Iterable)e, context);
        }else {
            save(e, context);
        }
    });

    context.removeLast();
}
 
开发者ID:chaokunyang,项目名称:jkes,代码行数:19,代码来源:EventSupport.java

示例3: getLocalDestination

import java.util.LinkedList; //导入方法依赖的package包/类
/**
 *  The last arg is expected to be a local path, if only one argument is
 *  given then the destination will be the current directory 
 *  @param args is the list of arguments
 */
protected void getLocalDestination(LinkedList<String> args)
throws IOException {
  String pathString = (args.size() < 2) ? Path.CUR_DIR : args.removeLast();
  try {
    dst = new PathData(new URI(pathString), getConf());
  } catch (URISyntaxException e) {
    if (Path.WINDOWS) {
      // Unlike URI, PathData knows how to parse Windows drive-letter paths.
      dst = new PathData(pathString, getConf());
    } else {
      throw new IOException("unexpected URISyntaxException", e);
    }
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:20,代码来源:CommandWithDestination.java

示例4: doVisit

import java.util.LinkedList; //导入方法依赖的package包/类
private void doVisit(FileVisitor visitor, File file, LinkedList<String> relativePath, int segmentIndex, AtomicBoolean stopFlag) {
    if (stopFlag.get()) {
        return;
    }

    String segment = patternSegments.get(segmentIndex);

    if (segment.contains("**")) {
        PatternSet patternSet = new PatternSet();
        patternSet.include(includePattern);
        patternSet.exclude(excludeSpec);
        DirectoryFileTree fileTree = new DirectoryFileTree(baseDir, patternSet);
        fileTree.visitFrom(visitor, file, new RelativePath(file.isFile(), relativePath.toArray(new String[relativePath.size()])));
    } else if (segment.contains("*") || segment.contains("?")) {
        PatternStep step = PatternStepFactory.getStep(segment, false);
        File[] children = file.listFiles();
        if (children == null) {
            if (!file.canRead()) {
                throw new GradleException(String.format("Could not list contents of directory '%s' as it is not readable.", file));
            }
            // else, might be a link which points to nothing, or has been removed while we're visiting, or ...
            throw new GradleException(String.format("Could not list contents of '%s'.", file));
        }
        for (File child : children) {
            if (stopFlag.get()) {
                break;
            }
            String childName = child.getName();
            if (step.matches(childName)) {
                relativePath.addLast(childName);
                doVisitDirOrFile(visitor, child, relativePath, segmentIndex + 1, stopFlag);
                relativePath.removeLast();
            }
        }
    } else {
        relativePath.addLast(segment);
        doVisitDirOrFile(visitor, new File(file, segment), relativePath, segmentIndex + 1, stopFlag);
        relativePath.removeLast();
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:41,代码来源:SingleIncludePatternFileTree.java

示例5: onMessageConsumed

import java.util.LinkedList; //导入方法依赖的package包/类
private synchronized void onMessageConsumed(ConsumerRecord<String, String> record) {
    log.info(String.format("Consumed message: [%s]", record));

    TopicPartition topicPartition = new TopicPartition(record.topic(), record.partition());

    if (!messagesByTopicPartition.containsKey(topicPartition)) {
        messagesByTopicPartition.put(topicPartition, new VersionedMessages(Lists.newLinkedList()));
    }

    VersionedMessages versionedMessages = messagesByTopicPartition.get(topicPartition);
    LinkedList<ConsumerRecord<String, String>> messages = versionedMessages.messages;
    messages.addFirst(record);

    if (messages.size() > maxTopicMessagesCount) {
        messages.removeLast();
    }

    versionedMessages.version.incrementAndGet();
}
 
开发者ID:enthusiast94,项目名称:kafka-visualizer,代码行数:20,代码来源:KafkaTopicsDataTracker.java

示例6: createTempJsFileWithScript

import java.util.LinkedList; //导入方法依赖的package包/类
private File createTempJsFileWithScript(final Script script, GeneratorOption[] options, final boolean replaceQuotes)
		throws IOException {
	// Compile script to get file content.
	final String content = compile(script, options, replaceQuotes);

	final String projectId = getProjectId(script);
	Path parentPath = createDirectory(getTempFolder(), projectId); // TODO IDE-

	// Get folder structure from qualified names.
	final LinkedList<String> segments = moduleQualifiedNameSegments(script);
	// Pop the file name from the segments.
	final String fileName = segments.removeLast();
	// Recursively create temporary folder structure.
	for (final String folderName : segments) {
		parentPath = createDirectory(parentPath, folderName);
	}

	final File file = new File(parentPath.toFile(), fileName + ".js");
	if (!file.exists()) {
		if (!file.createNewFile()) {
			throw new RuntimeException("Exception when creating new file: " + file);
		}
	}

	file.deleteOnExit();
	try (final PrintWriter pw = new PrintWriter(file)) {
		pw.print(content); // Make sure not to append but override content.
	}

	return file;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:32,代码来源:XpectN4JSES5TranspilerHelper.java

示例7: insertHighlightedLearner

import java.util.LinkedList; //导入方法依赖的package包/类
/**
    * Puts the searched learner in front of other learners in the list.
    */
   private static List<User> insertHighlightedLearner(User searchedLearner, List<User> latestLearners, int limit) {
latestLearners.remove(searchedLearner);
LinkedList<User> updatedLatestLearners = new LinkedList<User>(latestLearners);
updatedLatestLearners.addFirst(searchedLearner);
if (updatedLatestLearners.size() > limit) {
    updatedLatestLearners.removeLast();
}
return updatedLatestLearners;
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:MonitoringAction.java

示例8: addRecentCache

import java.util.LinkedList; //导入方法依赖的package包/类
private static void addRecentCache(Context context, Author... authors) {
    final LinkedList<Author> localCache = getRecentCache(context);

    // 避免重复添加
    for (Author author : authors) {
        if (author == null
                || author.getId() <= 0
                || TextUtils.isEmpty(author.getName())
                || author.getId() == AccountHelper.getUserId())
            continue;
        if (checkInContacts(localCache, author)) {
            // 移除后添加到头部
            int index = indexOfContacts(localCache, author);
            if (index >= 0) {
                localCache.remove(index);
                localCache.addFirst(author);
            }
        } else {
            localCache.addFirst(author);
        }
    }

    // 至多存储15条
    while (localCache.size() > 10) {
        localCache.removeLast();
    }

    CacheManager.saveToJson(context, RECENT_CACHE_FILE, localCache);
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:30,代码来源:ContactsCacheManager.java

示例9: calcIndents_processClosingTag

import java.util.LinkedList; //导入方法依赖的package包/类
private void calcIndents_processClosingTag(final String tagName, final int tagClosedOnLine, final TransferData transferData, final LinkedList<TagIndentationData> unprocessedOpeningTags, final Collection<TagIndentationData> matchedOpeningTags) throws BadLocationException {
    LinkedList<TagIndentationData> tagsToBeRemoved = new LinkedList<TagIndentationData>();

    while (!unprocessedOpeningTags.isEmpty()) {
        TagIndentationData processedTD = unprocessedOpeningTags.removeLast();

        if (areTagNamesEqual(tagName, processedTD.getTagName())) {
            processedTD.setClosedOnLine(tagClosedOnLine);
            matchedOpeningTags.add(processedTD);

            // mark all the stuff between unformattable tag as unformattable
            if (isUnformattableTag(tagName)) {
                for (int i = tagClosedOnLine - 1; i > processedTD.getLine(); i--) {
                    transferData.setNonFormattable(i);
                }
            }

            // forgetting preceding tags permanently
            tagsToBeRemoved.clear();
            break;
        } else {
            tagsToBeRemoved.add(processedTD);
        }
    }

    // if matching opening tag was not found on the stack put all the tags back
    unprocessedOpeningTags.addAll(tagsToBeRemoved);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:TagBasedLexerFormatter.java

示例10: finalRemove

import java.util.LinkedList; //导入方法依赖的package包/类
protected void finalRemove(JobInfo what, LinkedList<JobInfo> list, int position) {
	switch (position) {
	case 1:
		list.removeFirst();
		break;
	case 2:
		list.removeLast();
		break;
	default:
		list.remove(what);
		break;
	}
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:14,代码来源:LinkedJobInfoList.java

示例11: makeVersion

import java.util.LinkedList; //导入方法依赖的package包/类
private String makeVersion ( final String version, final String qualifier )
{
    if ( version == null )
    {
        // no version at all
        return null;
    }

    final LinkedList<String> toks = new LinkedList<String> ( Arrays.asList ( version.split ( "(\\.|-)" ) ) );

    getLog ().debug ( "Version split: " + toks );

    while ( toks.size () > 3 )
    {
        toks.removeLast ();
    }
    while ( toks.size () < 3 )
    {
        toks.add ( "0" );
    }

    if ( qualifier != null && !qualifier.isEmpty () )
    {
        toks.add ( qualifier );
    }

    final StringBuilder sb = new StringBuilder ();
    while ( !toks.isEmpty () )
    {
        if ( sb.length () > 0 )
        {
            sb.append ( '.' );
        }
        sb.append ( toks.pollFirst () );
    }
    return sb.toString ();
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:38,代码来源:AbstractSetQualifierMojo.java

示例12: processOptions

import java.util.LinkedList; //导入方法依赖的package包/类
@Override
protected void processOptions(LinkedList<String> args) throws IOException {
  if (args.size() == 0) {
    throw new IllegalArgumentException("<snapshotDir> is missing.");
  } 
  if (args.size() > 2) {
    throw new IllegalArgumentException("Too many arguments.");
  }
  if (args.size() == 2) {
    snapshotName = args.removeLast();
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:13,代码来源:SnapshotCommands.java

示例13: deleteEntity

import java.util.LinkedList; //导入方法依赖的package包/类
private void deleteEntity(Object entity, LinkedList<Object> context) {
        if(entity == null) return;

        context.addLast(entity);

        Object id = ReflectionUtils.getAnnotatedFieldValue(entity, Id.class);
        if(id == null)
        id = ReflectionUtils.getAnnotatedMethodReturnValue(entity, Id.class);
        if(id == null)
        throw new EventPublishException("Can't get entity id from " + entity);

        Class<?> domainClass = entity.getClass();
        String index = DocumentUtils.getIndexName(domainClass);
        String type = DocumentUtils.getTypeName(domainClass);

        EventContainer.addEvent(new Event.DeleteEvent(Event.EventType.DELETE, id, index, type, null));

        Collection<Object> cascadeEntity = getCascadeEntity(entity, context);
        cascadeEntity.forEach((e) -> {
            if(e instanceof Iterable) {
                deleteIterable((Iterable)e, context);
            }else {
                deleteEntity(e, context);
            }
        });

        context.removeLast();
}
 
开发者ID:chaokunyang,项目名称:jkes,代码行数:29,代码来源:EventSupport.java

示例14: finalRemove

import java.util.LinkedList; //导入方法依赖的package包/类
private void finalRemove(JobInfo what, LinkedList<JobInfo> list, int position) {
	switch (position) {
		case 1:
			list.removeFirst();
			break;
		case 2:
			list.removeLast();
			break;
		default:
			list.remove(what);
			break;
	}
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:14,代码来源:LinkedJobInfoList.java

示例15: diff_lineMode

import java.util.LinkedList; //导入方法依赖的package包/类
/**
 * Do a quick line-level diff on both strings, then rediff the parts for
 * greater accuracy.
 * This speedup can produce non-minimal diffs.
 * @param text1 Old string to be diffed.
 * @param text2 New string to be diffed.
 * @param deadline Time when the diff should be complete by.
 * @return Linked List of Diff objects.
 */
private LinkedList<Diff> diff_lineMode(String text1, String text2,
		long deadline) {
	// Scan the text on a line-by-line basis first.
	LinesToCharsResult b = diff_linesToChars(text1, text2);
	text1 = b.chars1;
	text2 = b.chars2;
	List<String> linearray = b.lineArray;

	LinkedList<Diff> diffs = diff_main(text1, text2, false, deadline);

	// Convert the diff back to original text.
	diff_charsToLines(diffs, linearray);
	// Eliminate freak matches (e.g. blank lines)
	diff_cleanupSemantic(diffs);

	// Rediff any replacement blocks, this time character-by-character.
	// Add a dummy entry at the end.
	diffs.add(new Diff(Operation.EQUAL, ""));
	int count_delete = 0;
	int count_insert = 0;
	String text_delete = "";
	String text_insert = "";
	ListIterator<Diff> pointer = diffs.listIterator();
	Diff thisDiff = pointer.next();
	while (thisDiff != null) {
		switch (thisDiff.operation) {
			case INSERT:
				count_insert++;
				text_insert += thisDiff.text;
				break;
			case DELETE:
				count_delete++;
				text_delete += thisDiff.text;
				break;
			case EQUAL:
				// Upon reaching an equality, check for prior redundancies.
				if (count_delete >= 1 && count_insert >= 1) {
					// Delete the offending records and add the merged ones.
					pointer.previous();
					for (int j = 0; j < count_delete + count_insert; j++) {
						pointer.previous();
						pointer.remove();
					}
					for (Diff newDiff : diff_main(text_delete, text_insert, false,
							deadline)) {
						pointer.add(newDiff);
					}
				}
				count_insert = 0;
				count_delete = 0;
				text_delete = "";
				text_insert = "";
				break;
		}
		thisDiff = pointer.hasNext() ? pointer.next() : null;
	}
	diffs.removeLast();  // Remove the dummy entry at the end.

	return diffs;
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:70,代码来源:diff_match_patch.java


注:本文中的java.util.LinkedList.removeLast方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。