本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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));
}
示例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);
}
示例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)));
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
}
示例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;
}