本文整理汇总了Java中java.util.LinkedList.addAll方法的典型用法代码示例。如果您正苦于以下问题:Java LinkedList.addAll方法的具体用法?Java LinkedList.addAll怎么用?Java LinkedList.addAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.LinkedList
的用法示例。
在下文中一共展示了LinkedList.addAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRemovedSymmetryGraph2
import java.util.LinkedList; //导入方法依赖的package包/类
public LinkedList<Edge> getRemovedSymmetryGraph2() {
LinkedList<Edge> list = new LinkedList<>();
for(LinkedList<Edge> edges : edgesByVertices.values()) {
list.addAll(edges);
}
if(graphType != GraphType.UNDIRECTED)
return list;
for(int i=0 ; i<list.size() ; i++) {
Edge e1 = list.get(i);
for(int j=0 ; j<list.size() ; j++) {
Edge e2 = list.get(j);
if(e1.checkSymmetry(e2))
list.remove(j);
}
}
return list;
}
示例2: writeLog
import java.util.LinkedList; //导入方法依赖的package包/类
public void writeLog(String logEntry) {
BeaconAction beaconAction = new BeaconAction(logEntry, System.currentTimeMillis());
LinkedList<BeaconAction> logsList = new LinkedList<>();
logsList.addAll(getLogs());
//add new entry at the beginning
logsList.add(0, beaconAction);
StringBuilder stringBuilder = new StringBuilder();
for (BeaconAction action : logsList) {
stringBuilder
.append(action.actionName).append(VALUE_SEPARATOR)
.append(action.timestamp)
.append(ENTRY_SEPARATOR);
}
//remove last separator
stringBuilder.replace(stringBuilder.length() - 1, stringBuilder.length() - 1, EMPTY_STRING);
preferences.edit().putString(PREFERENCE_LOGS, stringBuilder.toString()).apply();
}
示例3: addJobListener
import java.util.LinkedList; //导入方法依赖的package包/类
public void addJobListener(JobListener jobListener, List<Matcher<JobKey>> matchers) {
if (jobListener.getName() == null || jobListener.getName().length() == 0) {
throw new IllegalArgumentException(
"JobListener name cannot be empty.");
}
synchronized (globalJobListeners) {
globalJobListeners.put(jobListener.getName(), jobListener);
LinkedList<Matcher<JobKey>> matchersL = new LinkedList<Matcher<JobKey>>();
if(matchers != null && matchers.size() > 0)
matchersL.addAll(matchers);
else
matchersL.add(EverythingMatcher.allJobs());
globalJobListenersMatchers.put(jobListener.getName(), matchersL);
}
}
示例4: processJar
import java.util.LinkedList; //导入方法依赖的package包/类
/**
* Store all class names found in this jar file
*/
private static LinkedList<String> processJar(File jarfile, String basepath) {
// System.out.println("Processing JAR " + jarfile.getPath());
LinkedList<String> addlist = new LinkedList<String>();
try {
JarInputStream jarIS = new JarInputStream(new FileInputStream(
jarfile));
JarEntry entry = null;
while ((entry = jarIS.getNextJarEntry()) != null) {
String name = entry.getName();
if (name.endsWith(".class")) {
// System.out.println( entry.getAttributes().toString() );
if (!add(name, jarfile.getPath(), basepath).isEmpty())
addlist.addAll(add(name, jarfile.getPath(), basepath));
}
}
} catch (Exception e) {
}
return addlist;
}
示例5: processDirectory
import java.util.LinkedList; //导入方法依赖的package包/类
/**
* Recursively store all class names found in this directory and its
* subdirectories
*/
private static LinkedList<String> processDirectory(File directory, String basepath) {
// System.out.println("Processing " + directory.getPath());
LinkedList<String> addlist = new LinkedList<String>();
File[] files = directory.listFiles();
for (int i = 0; i < files.length; i++) {
File currentFile = files[i];
String name = currentFile.getName();
if (currentFile.isDirectory()) {
if (!processDirectory(currentFile, basepath).isEmpty())
addlist.addAll(processDirectory(currentFile, basepath));
} else if (name.endsWith(".class")) {
if (!add(name, currentFile.getPath(), basepath).isEmpty())
addlist.addAll(add(name, currentFile.getPath(), basepath));
} else if (name.endsWith(".jar")) {
if (!processJar(currentFile, basepath).isEmpty())
addlist.addAll(processJar(currentFile, basepath));
}
}
return addlist;
}
示例6: getWorkflows
import java.util.LinkedList; //导入方法依赖的package包/类
@Override
public List<WorkflowInstance> getWorkflows(WorkflowInstanceQuery workflowInstanceQuery, int maxItems, int skipCount)
{
LinkedList<WorkflowInstance> results = new LinkedList<WorkflowInstance>();
if (Boolean.FALSE.equals(workflowInstanceQuery.getActive()) == false)
{
//Add active.
results.addAll(getWorkflowsInternal(workflowInstanceQuery, true, maxItems, skipCount));
}
if (Boolean.TRUE.equals(workflowInstanceQuery.getActive()) == false)
{
//Add complete
results.addAll(getWorkflowsInternal(workflowInstanceQuery, false, maxItems, skipCount));
}
return results;
}
示例7: testAddAll2_IndexOutOfBoundsException
import java.util.LinkedList; //导入方法依赖的package包/类
/**
* addAll with too large an index throws IOOBE
*/
public void testAddAll2_IndexOutOfBoundsException() {
LinkedList l = new LinkedList();
l.add(new Object());
LinkedList m = new LinkedList();
m.add(new Object());
try {
l.addAll(4,m);
shouldThrow();
} catch (IndexOutOfBoundsException success) {}
}
示例8: visibleRegionsForPlayer
import java.util.LinkedList; //导入方法依赖的package包/类
public LinkedList<Region> visibleRegionsForPlayer(Player player)
{
LinkedList<Region> visibleRegions = new LinkedList<Region>();
LinkedList<Region> ownedRegions = ownedRegionsByPlayer(player);
visibleRegions.addAll(ownedRegions);
for(Region region : ownedRegions)
for(Region neighbor : region.getNeighbors())
if(!visibleRegions.contains(neighbor))
visibleRegions.add(neighbor);
return visibleRegions;
}
示例9: insert
import java.util.LinkedList; //导入方法依赖的package包/类
@Override
public void insert(String key, LinkedList<V> value) {
if (key == null) {
return;
}
key = trimLowercaseString(key);
key = convertWordToT9(key);
TrieNode<LinkedList<V>> crawler = root;
for (int i = 0; i < key.length(); i++) {
final char c = key.charAt(i);
if (!crawler.containsChild(c)) {
crawler = crawler.addChild(c);
} else {
crawler = crawler.getChild(c);
}
}
crawler.setKey(true);
if (crawler.getValue() == null) {
crawler.setValue(new LinkedList<V>());
}
final LinkedList<V> valuesList = crawler.getValue();
valuesList.addAll(value);
crawler.setValue(valuesList);
}
示例10: getWorkflowsInternal
import java.util.LinkedList; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private List<WorkflowInstance> getWorkflowsInternal(WorkflowInstanceQuery workflowInstanceQuery, boolean isActive, int maxItems, int skipCount)
{
// MNT-9074 My Tasks fails to render if tasks quantity is excessive
HistoricProcessInstanceQuery query = createQuery(workflowInstanceQuery, isActive);
LinkedList<WorkflowInstance> results = new LinkedList<WorkflowInstance>();
List<HistoricProcessInstance> completedInstances;
if (maxItems > 0)
{
completedInstances = query.orderByProcessInstanceDuration().desc().listPage(skipCount, maxItems);
}
else
{
completedInstances = query.list();
}
List<WorkflowInstance> completedResults = typeConverter.doSpecialTenantFilterAndSafeConvert(completedInstances, new Function<HistoricProcessInstance, String>()
{
public String apply(HistoricProcessInstance historicProcessInstance)
{
ProcessDefinition procDef = activitiUtil.getProcessDefinition(historicProcessInstance.getProcessDefinitionId());
return procDef.getKey();
}
});
results.addAll(completedResults);
return results;
}
示例11: createConnection
import java.util.LinkedList; //导入方法依赖的package包/类
private <T extends Connection> T createConnection ( final EClass connectionClass, final Class<T> clazz, final Global global, final Local local )
{
final T connection = clazz.cast ( OsgiFactory.eINSTANCE.create ( connectionClass ) );
final String tag = connection.getTypeTag ();
final String cname = String.format ( "global.%s.to.%s.%s", Names.makeName ( global.getGlobal () ), local.getId (), tag );
connection.setName ( cname );
// set credentials
connection.setCredentials ( EcoreUtil.copy ( findCredentials ( global, local ) ) );
// add connection to "from"
global.getGlobal ().getConnections ().add ( connection );
// point connection to "to"
final LinkedList<Endpoint> endpoints = new LinkedList<> ();
for ( final Exporter exporter : local.getLocal ().getExporter () )
{
endpoints.addAll ( connection.getPossibleEndpoints ( exporter ) );
}
if ( endpoints.isEmpty () )
{
throw new IllegalStateException ( String.format ( "Unable to find an exporter that could serve as endpoint for connection type %s on master %s", connectionClass.getName (), local.getLocal ().getName () ) );
}
final Endpoint endpoint = endpoints.getFirst ();
connection.setEndpoint ( endpoint );
// FIXME: adding connection analyzers to "app", in phase 1
return connection;
}
示例12: copy
import java.util.LinkedList; //导入方法依赖的package包/类
public void copy(StructExprRecog structExprRecog) {
mbarrayBiValues = structExprRecog.mbarrayBiValues;
mnExprRecogType = structExprRecog.mnExprRecogType;
mType = structExprRecog.mType;
mstrFont = structExprRecog.mstrFont;
LinkedList<StructExprRecog> listChildren = new LinkedList<StructExprRecog>();
listChildren.addAll(structExprRecog.mlistChildren);
mlistChildren = listChildren;
mnLeft = structExprRecog.mnLeft;
mnTop = structExprRecog.mnTop;
mnWidth = structExprRecog.mnWidth;
mnHeight = structExprRecog.mnHeight;
mimgChop = structExprRecog.mimgChop;
mdSimilarity = structExprRecog.mdSimilarity;
}
示例13: getStats
import java.util.LinkedList; //导入方法依赖的package包/类
public String getStats() {
StringBuilder sb = new StringBuilder();
int pNodes = 0;
int cNodes = 0;
int mNodes = 0;
LinkedList<Node> worklist = new LinkedList<Node>();
worklist.add(this);
Node curNode;
while (!worklist.isEmpty()) {
curNode = worklist.poll();
worklist.addAll(curNode.childs);
for (Node n: curNode.childs) {
if (n instanceof PackageNode)
pNodes++;
else if (n instanceof ClassNode)
cNodes++;
else if (n instanceof MethodNode)
mNodes++;
}
}
sb.append("Node stats:\n");
sb.append(Utils.INDENT + "- contains " + mNodes + " method hashes.\n");
sb.append(Utils.INDENT + "- contains " + cNodes + " clazz hashes.\n");
sb.append(Utils.INDENT + "- contains " + pNodes + " package hashes.");
return sb.toString();
}
示例14: classlist
import java.util.LinkedList; //导入方法依赖的package包/类
public static LinkedList<String> classlist() {
LinkedList<String> clist = new LinkedList<String>();
ArrayList<String> paths = new ArrayList<String>();
String cpath = System.getProperty("java.class.path");
// System.out.println( "From Etomica plugin: java.class.path = " + cpath
// );
StringTokenizer tz = new StringTokenizer(cpath, PATHSEP);
while (tz.hasMoreTokens()) {
paths.add(tz.nextToken());
}
for (int i = 0; i < paths.size(); i++) {
File file = new File(paths.get(i));
if (file.isDirectory()) {
if (!processDirectory(file, file.getAbsolutePath()).isEmpty())
clist.addAll(processDirectory(file, file
.getAbsolutePath()));
} else {
if (!processJar(file, file.getAbsolutePath()).isEmpty())
clist.addAll(processJar(file, file.getAbsolutePath()));
}
}
return clist;
}
示例15: getWarnings
import java.util.LinkedList; //导入方法依赖的package包/类
@Override
public List<PlotConfigurationError> getWarnings() {
LinkedList<PlotConfigurationError> warnings = new LinkedList<PlotConfigurationError>();
warnings.addAll(groupedMasterDimensionConfig.getWarnings());
if (warnings.size() > 0) {
return warnings;
}
warnings.addAll(ungroupedMasterDimensionConfig.getWarnings());
return warnings;
}