當前位置: 首頁>>代碼示例>>Java>>正文


Java LinkedHashSet類代碼示例

本文整理匯總了Java中java.util.LinkedHashSet的典型用法代碼示例。如果您正苦於以下問題:Java LinkedHashSet類的具體用法?Java LinkedHashSet怎麽用?Java LinkedHashSet使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


LinkedHashSet類屬於java.util包,在下文中一共展示了LinkedHashSet類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: withQueryFilters

import java.util.LinkedHashSet; //導入依賴的package包/類
public QuerySpec withQueryFilters(QueryFilter... queryFilters) {
    if (queryFilters == null) {
        this.queryFilters = null;
    } else {
        Set<String> names = new LinkedHashSet<String>();
        for (QueryFilter e : queryFilters) {
            names.add(e.getAttribute());
        }
        if (names.size() != queryFilters.length) {
            throw new IllegalArgumentException(
                    "attribute names must not duplicate in the list of query filters");
        }
        this.queryFilters = Arrays.asList(queryFilters);
    }
    return this;
}
 
開發者ID:aws,項目名稱:aws-sdk-java-v2,代碼行數:17,代碼來源:QuerySpec.java

示例2: withCollectionParam

import java.util.LinkedHashSet; //導入依賴的package包/類
protected T withCollectionParam(final String name, final Object value) {
    // Sanity test, if we got passed null, we should remove the collection
    if (value == null) {
        // This should remove it.
        return setParam(name, null);
    }

    // Sanity test, if we got passed a collection, we should handle it gracefully.
    if (value instanceof Collection) {
        return withCollectionParams(name, (Collection) value);
    }

    Collection<Object> existingValues = getParam(name);
    if (existingValues == null) {
        // Using linked hash set to preserve ordering.
        existingValues = new LinkedHashSet<>();
    }

    existingValues.add(value);

    return setParam(name, existingValues);
}
 
開發者ID:Crim,項目名稱:pardot-java-client,代碼行數:23,代碼來源:BaseRequest.java

示例3: calculateTop

import java.util.LinkedHashSet; //導入依賴的package包/類
/**
 * Calculates the top event of the {@link BDD} based on a functionTransformer that delivers for each variable
 * {@code T} a double value.
 * 
 * @param <T>
 *            the type of variable
 * @param bdd
 *            the bdd
 * @param transformer
 *            the transformer that returns a double value for each variable
 * @return the top event of the bdd
 */
public static <T> double calculateTop(BDD<T> bdd, Transformer<T, Double> transformer) {
	if (bdd.isOne()) {
		return 1.0;
	}
	if (bdd.isZero()) {
		return 0.0;
	}

	Set<BDD<T>> upSort = new LinkedHashSet<>();
	traverseBDD(bdd, upSort);
	double top = evaluate(bdd, transformer, upSort);
	for (BDD<T> ups : upSort) {
		ups.free();
	}
	return top;
}
 
開發者ID:felixreimann,項目名稱:jreliability,代碼行數:29,代碼來源:BDDs.java

示例4: apply

import java.util.LinkedHashSet; //導入依賴的package包/類
@Override
public Set<NitriteId> apply(final NitriteMap<NitriteId, Document> documentMap) {
    Set<NitriteId> result = new LinkedHashSet<>();
    ExecutorService executorService = nitriteService.getNitriteContext().getWorkerPool();

    try {
        List<Callable<Set<NitriteId>>> tasks = createTasks(filters, documentMap);

        List<Future<Set<NitriteId>>> futures = executorService.invokeAll(tasks);
        for (Future<Set<NitriteId>> future : futures) {
            Set<NitriteId> nitriteIds = future.get();
            if (nitriteIds != null) {
                result.addAll(nitriteIds);
            }
        }
    } catch (FilterException fe) {
        throw fe;
    } catch (Throwable t) {
        throw new FilterException(INVALID_OR_FILTER, t);
    }

    return result;
}
 
開發者ID:dizitart,項目名稱:nitrite-database,代碼行數:24,代碼來源:OrFilter.java

示例5: doFindVector3s

import java.util.LinkedHashSet; //導入依賴的package包/類
private static List<Vector3> doFindVector3s(final Scene scene) {
	final Set<Vector3> vector3s = new LinkedHashSet<>();
	
	for(final Shape shape : scene.getShapes()) {
		if(shape instanceof Plane) {
			final Plane plane = Plane.class.cast(shape);
			
			final Vector3 surfaceNormal = plane.getSurfaceNormal();
			
			vector3s.add(surfaceNormal);
		} else if(shape instanceof Triangle) {
			final Triangle triangle = Triangle.class.cast(shape);
			
			final Vector3 a = triangle.getA().getNormal();
			final Vector3 b = triangle.getB().getNormal();
			final Vector3 c = triangle.getC().getNormal();
			
			vector3s.add(a);
			vector3s.add(b);
			vector3s.add(c);
		}
	}
	
	return new ArrayList<>(vector3s);
}
 
開發者ID:macroing,項目名稱:Dayflower-Path-Tracer,代碼行數:26,代碼來源:CompiledScene.java

示例6: zrangeByLex

import java.util.LinkedHashSet; //導入依賴的package包/類
@Test
public void zrangeByLex() {
  jedis.zadd("foo", 1, "aa");
  jedis.zadd("foo", 1, "c");
  jedis.zadd("foo", 1, "bb");
  jedis.zadd("foo", 1, "d");

  Set<String> expected = new LinkedHashSet<String>();
  expected.add("bb");
  expected.add("c");

  // exclusive aa ~ inclusive c
  assertEquals(expected, jedis.zrangeByLex("foo", "(aa", "[c"));

  expected.clear();
  expected.add("bb");
  expected.add("c");

  // with LIMIT
  assertEquals(expected, jedis.zrangeByLex("foo", "-", "+", 1, 2));
}
 
開發者ID:qq1588518,項目名稱:JRediClients,代碼行數:22,代碼來源:SortedSetCommandsTest.java

示例7: getChildUsers

import java.util.LinkedHashSet; //導入依賴的package包/類
/**
 * Get child users of this group
 * @param paging Paging object with max number to return, and items to skip
 * @param sortBy What to sort on (authorityName, shortName or displayName)
 */
public ScriptUser[] getChildUsers(ScriptPagingDetails paging, String sortBy)
{
    if (childUsers == null)
    {
        Set<String> children = getChildNamesOfType(AuthorityType.USER);
        Set<ScriptUser> users = new LinkedHashSet<ScriptUser>();
        for (String authority : children)
        {
            ScriptUser user = new ScriptUser(authority, null, serviceRegistry, this.scope);
            users.add(user);
        }
        childUsers = users.toArray(new ScriptUser[users.size()]);
    }
    return makePagedAuthority(paging, sortBy, childUsers);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:21,代碼來源:ScriptGroup.java

示例8: sigMETA

import java.util.LinkedHashSet; //導入依賴的package包/類
/**
 * Returns the AlloyType corresponding to the given sig; create an AlloyType
 * for it if none existed before.
 */
private void sigMETA(SubsetSig s) throws Err {
	AlloyAtom atom;
	AlloyType type = sig2type.get(s);
	if (type != null)
		return;
	type = makeType(s.label, s.isOne != null, s.isAbstract != null, false, s.isPrivate != null, s.isMeta != null,
			s.isEnum != null);
	atom = new AlloyAtom(type, Integer.MAX_VALUE, s.label);
	atom2sets.put(atom, new LinkedHashSet<AlloySet>());
	sig2atom.put(s, atom);
	sig2type.put(s, type);
	ts.put(type, AlloyType.SET);
	for (Sig p : ((SubsetSig) s).parents) {
		if (p instanceof SubsetSig)
			sigMETA((SubsetSig) p);
		else
			sigMETA((PrimSig) p);
		ins.add(new AlloyTuple(atom, sig2atom.get(p)));
	}
}
 
開發者ID:AlloyTools,項目名稱:org.alloytools.alloy,代碼行數:25,代碼來源:StaticInstanceReader.java

示例9: getToolingImpl

import java.util.LinkedHashSet; //導入依賴的package包/類
private ClassPath getToolingImpl() {
    if (!gradleHomeDir.exists()) {
        throw new IllegalArgumentException(String.format("The specified %s does not exist.", locationDisplayName));
    }
    if (!gradleHomeDir.isDirectory()) {
        throw new IllegalArgumentException(String.format("The specified %s is not a directory.", locationDisplayName));
    }
    File libDir = new File(gradleHomeDir, "lib");
    if (!libDir.isDirectory()) {
        throw new IllegalArgumentException(String.format("The specified %s does not appear to contain a Gradle distribution.", locationDisplayName));
    }
    LinkedHashSet<File> files = new LinkedHashSet<File>();
    for (File file : libDir.listFiles()) {
        if (hasExtension(file, ".jar")) {
            files.add(file);
        }
    }
    return new DefaultClassPath(files);
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:20,代碼來源:DistributionFactory.java

示例10: partiallyVisibleUserTopLevelTypes

import java.util.LinkedHashSet; //導入依賴的package包/類
/** Returns every top-level user type that is itself visible or has a visible subtype.
 * @param vizState
 */
static Set<AlloyType> partiallyVisibleUserTopLevelTypes(final VizState vizState) {
   final AlloyModel model = vizState.getOriginalModel();
   final Set<AlloyType> visibleUserTypes = visibleUserTypes(vizState);
   //final Set<AlloyType> topLevelTypes = topLevelTypes(vizState);

   final Set<AlloyType> result = new LinkedHashSet<AlloyType>();

   for (final AlloyType t : visibleUserTypes) {
      if (visibleUserTypes.contains(t)) {
         result.add(model.getTopmostSuperType(t));
      }
   }

   return Collections.unmodifiableSet(result);
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:19,代碼來源:MagicUtil.java

示例11: put

import java.util.LinkedHashSet; //導入依賴的package包/類
/**
 * Stores the Array in static for username + connectionId
 * 
 * @param array
 *            the Array to store
 */
public void put(Array array) {

	debug("Creating an array for user: " + connectionKey);
	if (array == null) {
		throw new IllegalArgumentException("array is null!");
	}

	Set<Array> arraySet = arrayMap.get(connectionKey);
	if (arraySet == null) {
		arraySet = new LinkedHashSet<Array>();
	}

	arraySet.add(array);
	arrayMap.put(connectionKey, arraySet);

}
 
開發者ID:kawansoft,項目名稱:aceql-http,代碼行數:23,代碼來源:ConnectionStore.java

示例12: deepClone

import java.util.LinkedHashSet; //導入依賴的package包/類
/**
 * Makes a deep copy (for security)
 */
public Base deepClone() {
	Base newBase = new Base(getPosition().deepCopy(), teamName, team.deepCopy(), isHomeBase);
	
	newBase.energy = energy;
	newBase.setAlive(isAlive);
	newBase.id = id;
	newBase.maxEnergy = maxEnergy;
	newBase.currentPowerups = new LinkedHashSet<SpaceSettlersPowerupEnum>(currentPowerups);
	newBase.weaponCapacity = weaponCapacity;
	newBase.healingIncrement = healingIncrement;
	newBase.resources = new ResourcePile();
	newBase.resources.add(resources);
	newBase.numFlags = numFlags;
	return newBase;
}
 
開發者ID:CatherineHa,項目名稱:Proj4,代碼行數:19,代碼來源:Base.java

示例13: getAncestors

import java.util.LinkedHashSet; //導入依賴的package包/類
/**
 * Return an unordered set all the foreign key ancestor tables for the given table
 * @param catalog_tbl
 */
public Collection<Table> getAncestors(Table catalog_tbl) {
    Database catalog_db = (Database) catalog_tbl.getParent();
    Set<Table> ret = new LinkedHashSet<Table>();
    String key = CatalogKey.createKey(catalog_tbl);
    for (String ancestor_key : this.table_ancestors.get(key)) {
        // If this table is missing from the catalog, then we want to stop
        // the ancestor list
        Table ancestor_tbl = CatalogKey.getFromKey(catalog_db, ancestor_key, Table.class);
        if (ancestor_tbl == null)
            break;
        // Otherwise, add it to our list
        ret.add(ancestor_tbl);
    } // FOR
    return (ret);
}
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:20,代碼來源:DependencyUtil.java

示例14: getAndRemZRange

import java.util.LinkedHashSet; //導入依賴的package包/類
public Set<String> getAndRemZRange(String key, long score) {
  Jedis jedis = null;
  try {
    jedis = pool.getResource();
    Transaction trans = jedis.multi();
    trans.zrangeByScore(key.getBytes(), MIN_INF, SafeEncoder.encode(String.valueOf(score)));
    trans.zremrangeByScore(key.getBytes(), MIN_INF, SafeEncoder.encode(String.valueOf(score)));
    List<Object> response = trans.exec();
    Set<byte[]> data = (Set<byte[]>) response.get(0);
    Set<String> members = new LinkedHashSet<>(data.size());
    for (byte[] d : data) {
      members.add(new String(d));
    }
    pool.returnResource(jedis);
    return members;
  } catch (Exception e) {
    LOGGER.warn("Failed to get zrem keys from cache {0}:{1}", key, score, e);
    pool.returnBrokenResource(jedis);
    throw e;
  }
}
 
開發者ID:logistimo,項目名稱:logistimo-web-service,代碼行數:22,代碼來源:RedisMemcacheService.java

示例15: getInterestedLoggersByTask

import java.util.LinkedHashSet; //導入依賴的package包/類
private synchronized Collection<AntLogger> getInterestedLoggersByTask(String task) {
    Collection<AntLogger> c = interestedLoggersByTask.get(task);
    if (c == null) {
        c = new LinkedHashSet<AntLogger>(interestedLoggers.size());
        interestedLoggersByTask.put(task, c);
        for (AntLogger l : interestedLoggers) {
            String[] tasks = l.interestedInTasks(thisSession);
            if (tasks == AntLogger.ALL_TASKS ||
                    (task != null && Arrays.asList(tasks).contains(task)) ||
                    (task == null && tasks == AntLogger.NO_TASKS)) {
                c.add(l);
            }
        }
        LOG.log(Level.FINEST, "getInterestedLoggersByTask: task={0} loggers={1}", new Object[] {task, c});
    }
    return c;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:NbBuildLogger.java


注:本文中的java.util.LinkedHashSet類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。