java.util.LinkedHashSet.retainAll()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(168)

本文整理了Java中java.util.LinkedHashSet.retainAll()方法的一些代码示例,展示了LinkedHashSet.retainAll()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LinkedHashSet.retainAll()方法的具体详情如下:
包路径:java.util.LinkedHashSet
类名称:LinkedHashSet
方法名:retainAll

LinkedHashSet.retainAll介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-data-redis

@Override
public boolean retainAll(Collection<?> c) {
  return delegate.retainAll(c);
}

代码示例来源:origin: btraceio/btrace

@Override
protected String getCommonSuperClass(String type1, String type2) {
  // Using type closures resolved via the associate classloader
  LinkedHashSet<String> type1Closure = new LinkedHashSet<>();
  LinkedHashSet<String> type2Closure = new LinkedHashSet<>();
  InstrumentUtils.collectHierarchyClosure(targetCL, type1, type1Closure, true);
  InstrumentUtils.collectHierarchyClosure(targetCL, type2, type2Closure, true);
  // basically, do intersection
  type1Closure.retainAll(type2Closure);
  // if the intersection is not empty the first element is the closest common ancestor
  Iterator<String> iter = type1Closure.iterator();
  if (iter.hasNext()) {
    String common = iter.next();
    return common;
  }
  return Constants.OBJECT_INTERNAL;
}

代码示例来源:origin: elastic/elasticsearch-hadoop

private static FieldType resolveTypeConflict(String fullName, FieldType existing, FieldType incoming) {
  // Prefer to upcast the incoming field to the existing first
  LinkedHashSet<FieldType> incomingSuperTypes = incoming.getCastingTypes();
  if (incomingSuperTypes.contains(existing)) {
    // Incoming can be cast to existing.
    return existing;
  }
  // See if existing can be upcast to the incoming field's type next
  LinkedHashSet<FieldType> existingSuperTypes = existing.getCastingTypes();
  if (existingSuperTypes.contains(incoming)) {
    // Existing can be cast to incoming
    return incoming;
  }
  // Finally, Try to pick the lowest common super type for both fields if it exists
  if (incomingSuperTypes.size() > 0 && existingSuperTypes.size() > 0) {
    LinkedHashSet<FieldType> combined = new LinkedHashSet<FieldType>(incomingSuperTypes);
    combined.retainAll(existingSuperTypes);
    if (combined.size() > 0) {
      return combined.iterator().next();
    }
  }
  // If none of the above options succeed, the fields are conflicting
  throw new EsHadoopIllegalArgumentException("Incompatible types found in multi-mapping: " +
      "Field ["+fullName+"] has conflicting types of ["+existing+"] and ["+
      incoming+"].");
}

代码示例来源:origin: alibaba/jvm-sandbox

@Override
public MatchingResult matching(ClassStructure classStructure) {
  boolean isFirst = true;
  final MatchingResult result = new MatchingResult();
  final LinkedHashSet<BehaviorStructure> found = new LinkedHashSet<BehaviorStructure>();
  if (null == matcherArray) {
    return result;
  }
  for (final Matcher subMatcher : matcherArray) {
    final MatchingResult subResult = subMatcher.matching(classStructure);
    // 只要有一次匹配失败,剩下的是取交集运算,所以肯定也没戏,就不用花这个计算了
    if (!subResult.isMatched()) {
      return result;
    }
    if (isFirst) {
      found.addAll(subResult.getBehaviorStructures());
      isFirst = false;
    } else {
      found.retainAll(subResult.getBehaviorStructures());
    }
  }
  if (!found.isEmpty()) {
    result.getBehaviorStructures().addAll(found);
  }
  return result;
}

代码示例来源:origin: jamesagnew/hapi-fhir

@Override
public boolean retainAll(Collection<?> theC) {
  myOrderedTags = null;
  return myTagSet.retainAll(theC);
}

代码示例来源:origin: geotools/geotools

/**
 * Retains only the elements in this set that are contained in the specified collection.
 *
 * @throws UnsupportedOperationException if this collection is unmodifiable.
 */
@Override
public boolean retainAll(Collection<?> c) throws UnsupportedOperationException {
  synchronized (getLock()) {
    checkWritePermission();
    return super.retainAll(c);
  }
}

代码示例来源:origin: spring-projects/spring-data-mongodb

lhs2.retainAll(rhs.entrySet());

代码示例来源:origin: io.snappydata/gemfire-core

@Override
public boolean retainAll(Collection c) {
 //if (c instanceof StructSet) {
  //return retainAll((StructSet)c);
 //}
 return super.retainAll(c);
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

@Override
public boolean retainAll(Collection<?> c) {
  return set.retainAll(c);
}

代码示例来源:origin: org.springframework.data/spring-data-redis

@Override
public boolean retainAll(Collection<?> c) {
  return delegate.retainAll(c);
}

代码示例来源:origin: org.apache.flink/flink-runtime

@Override
public boolean retainAll(Collection<?> c) {
  return set.retainAll(c);
}

代码示例来源:origin: ca.uhn.hapi.fhir/hapi-fhir-base

@Override
public boolean retainAll(Collection<?> theC) {
  myOrderedTags = null;
  return myTagSet.retainAll(theC);
}

代码示例来源:origin: hazelcast/hazelcast-jet

/** Retains only the {@code migrations} in the completed migration list. Acquires the partition service lock. */
void retainCompletedMigrations(Collection<MigrationInfo> migrations) {
  partitionServiceLock.lock();
  try {
    completedMigrations.retainAll(migrations);
  } finally {
    partitionServiceLock.unlock();
  }
}

代码示例来源:origin: com.hazelcast/hazelcast-all

/** Retains only the {@code migrations} in the completed migration list. Acquires the partition service lock. */
void retainCompletedMigrations(Collection<MigrationInfo> migrations) {
  partitionServiceLock.lock();
  try {
    completedMigrations.retainAll(migrations);
  } finally {
    partitionServiceLock.unlock();
  }
}

代码示例来源:origin: com.github.kristiankime/functional-collections

@Override
public GuavaImFSet<E> retainAllCp(Collection<?> c) {
  LinkedHashSet<E> set = Sets.newLinkedHashSet(this);
  set.retainAll(c);
  return new GuavaImFSet<E>(ImmutableSet.copyOf(set));
}

代码示例来源:origin: org.springframework.data/spring-data-mongodb

lhs2.retainAll(rhs.entrySet());

代码示例来源:origin: org.geotools/gt-metadata

/**
 * Retains only the elements in this set that are contained in the specified collection.
 *
 * @throws UnsupportedOperationException if this collection is unmodifiable.
 */
@Override
public boolean retainAll(Collection<?> c) throws UnsupportedOperationException {
  synchronized (getLock()) {
    checkWritePermission();
    return super.retainAll(c);
  }
}

代码示例来源:origin: org.apache.openejb.patch/openjpa-kernel

@Override
public boolean retainAll(Collection paramCollection) {
  if (_directAccess) {
    return super.retainAll(paramCollection);
  }
  if (isDelayLoad()) {
    load();
  }
  return ProxyCollections.retainAll(this, paramCollection);
}

代码示例来源:origin: org.apache.openjpa/openjpa-all

@Override
public boolean retainAll(Collection paramCollection) {
  if (_directAccess) {
    return super.retainAll(paramCollection);
  }
  if (isDelayLoad()) {
    load();
  }
  return ProxyCollections.retainAll(this, paramCollection);
}

代码示例来源:origin: org.apache.openjpa/openjpa-kernel

@Override
public boolean retainAll(Collection paramCollection) {
  if (_directAccess) {
    return super.retainAll(paramCollection);
  }
  if (isDelayLoad()) {
    load();
  }
  return ProxyCollections.retainAll(this, paramCollection);
}

相关文章