本文整理汇总了Java中java.util.SortedSet.contains方法的典型用法代码示例。如果您正苦于以下问题:Java SortedSet.contains方法的具体用法?Java SortedSet.contains怎么用?Java SortedSet.contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.SortedSet
的用法示例。
在下文中一共展示了SortedSet.contains方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: EncodingNode
import java.util.SortedSet; //导入方法依赖的package包/类
public EncodingNode(String[] ids, CodeSequence[] seqs) {
SortedSet<String> idSet = new TreeSet<String>();
SortedSet<String> nidSet = new TreeSet<String>();
for (int i = 0; i < ids.length; i++) {
String nid = ids[i].toLowerCase().replaceAll("[^a-z0-9]+", "");
if (ids[i].length() > 0 && nid.length() > 0) {
if (idSet.contains(ids[i])) throw new IllegalArgumentException("Duplicate id: " + ids[i]);
if (nidSet.contains(nid)) throw new IllegalArgumentException("Duplicate id:" + nid);
idSet.add(ids[i]);
nidSet.add(nid);
}
}
if (idSet.isEmpty() || nidSet.isEmpty()) throw new IllegalArgumentException("No ids");
this.ids = idSet.toArray(new String[idSet.size()]);
this.nids = nidSet.toArray(new String[nidSet.size()]);
SortedSet<CodeSequence> seqSet = new TreeSet<CodeSequence>();
for (int i = 0; i < seqs.length; i++) {
if (seqs[i].length() > 0) {
if (seqSet.contains(seqs[i])) throw new IllegalArgumentException("Duplicate code sequence: " + seqs[i]);
seqSet.add(seqs[i]);
}
}
if (seqSet.isEmpty()) throw new IllegalArgumentException("No code sequences");
this.seqs = seqSet.toArray(new CodeSequence[seqSet.size()]);
}
示例2: implementingClasses
import java.util.SortedSet; //导入方法依赖的package包/类
/**
* Return the set of classes which implement the interface passed.
*
* @param typeElement interface whose implementing-classes set is required.
*/
public SortedSet<TypeElement> implementingClasses(TypeElement typeElement) {
SortedSet<TypeElement> result = get(implementingClasses, typeElement);
SortedSet<TypeElement> intfcs = allSubClasses(typeElement, false);
// If class x implements a subinterface of typeElement, then it follows
// that class x implements typeElement.
Iterator<TypeElement> subInterfacesIter = intfcs.iterator();
while (subInterfacesIter.hasNext()) {
Iterator<TypeElement> implementingClassesIter
= implementingClasses(subInterfacesIter.next()).iterator();
while (implementingClassesIter.hasNext()) {
TypeElement c = implementingClassesIter.next();
if (!result.contains(c)) {
result.add(c);
}
}
}
return result;
}
示例3: verify
import java.util.SortedSet; //导入方法依赖的package包/类
void verify(StackFrame frame) {
if (frame.getDeclaringClass() != clazz)
return;
int bci = frame.getByteCodeIndex();
int lineNumber = frame.getLineNumber();
System.out.format("%s.%s bci %d (%s:%d)%n",
frame.getClassName(), frame.getMethodName(), bci,
frame.getFileName(), lineNumber);
MethodInfo method = methods.get(frame.getMethodName());
SortedSet<Integer> values = method.findLineNumbers(bci).get();
if (!values.contains(lineNumber)) {
throw new RuntimeException("line number for bci: " + bci + " "
+ lineNumber + " not matched line number table: " + values);
}
}
示例4: isLogZnodesMapPopulated
import java.util.SortedSet; //导入方法依赖的package包/类
/**
* @return 1 when the map is not empty.
*/
private int isLogZnodesMapPopulated() {
Collection<SortedSet<String>> sets = logZnodesMap.values();
if (sets.size() > 1) {
throw new RuntimeException("unexpected size of logZnodesMap: " + sets.size());
}
if (sets.size() == 1) {
SortedSet<String> s = sets.iterator().next();
for (String file : files) {
// at least one file was missing
if (!s.contains(file)) {
return 0;
}
}
return 1; // we found all the files
}
return 0;
}
示例5: getProjectLibraries
import java.util.SortedSet; //导入方法依赖的package包/类
public Set<File> getProjectLibraries() {
Set<File> classpath = new HashSet<>();
SourceSetContainer sourceSets = (SourceSetContainer) project.getProperties().get("sourceSets");
if (sourceSets != null) {
SortedSet<String> availableSourceSetNames = sourceSets.getNames();
for (String sourceSetName : Arrays.asList("main", "test", "integrationTest")) {
if (availableSourceSetNames.contains(sourceSetName)) {
SourceSet sourceSet = sourceSets.getByName(sourceSetName);
classpath.add(sourceSet.getOutput().getClassesDir());
}
}
}
// add dependencies from configured gradle configuration to url (usually test or integrationTest)
TSGeneratorConfig generatorConfiguration = project.getExtensions().getByType(TSGeneratorConfig.class);
String configurationName = generatorConfiguration.getRuntime().getConfiguration();
ConfigurationContainer configurations = project.getConfigurations();
Configuration runtimeConfiguration = configurations.findByName(configurationName + "Runtime");
if (runtimeConfiguration == null) {
runtimeConfiguration = configurations.getByName(configurationName);
}
classpath.addAll(runtimeConfiguration.getFiles());
for (File file : classpath) {
LOGGER.debug("classpath entry: {}", file);
}
return classpath;
}
示例6: addDefaultFields
import java.util.SortedSet; //导入方法依赖的package包/类
/**
* Any fields that are in otherFields but not in myFields are added to myFields as defaults. When
* adding fields they are inserted in the natural sort order. Note: myFields may be modified by
* this call.
*/
private static void addDefaultFields(SortedSet<PdxField> myFields,
SortedSet<PdxField> otherFields) {
for (PdxField f : otherFields) {
if (!myFields.contains(f)) {
myFields.add(new DefaultPdxField(f));
}
}
}
示例7: add
import java.util.SortedSet; //导入方法依赖的package包/类
/**
* Adjust the Class Tree. Add the class interface in to it's super classes
* or super interface's sub-interface set.
*
* @param map the entire map.
* @param superclass java.lang.Object or the super-interface.
* @param typeElement sub-interface to be mapped.
* @returns boolean true if class added, false if class already processed.
*/
private boolean add(Map<TypeElement, SortedSet<TypeElement>> map, TypeElement superclass, TypeElement typeElement) {
SortedSet<TypeElement> sset = map.computeIfAbsent(superclass, s -> new TreeSet<>(comparator));
if (sset.contains(typeElement)) {
return false;
} else {
sset.add(typeElement);
}
return true;
}
示例8: supports
import java.util.SortedSet; //导入方法依赖的package包/类
/**
* Returns true if a given feature is supported in the given layout version
* @param map layout feature map
* @param f Feature
* @param lv LayoutVersion
* @return true if {@code f} is supported in layout version {@code lv}
*/
public static boolean supports(Map<Integer, SortedSet<LayoutFeature>> map,
final LayoutFeature f, final int lv) {
final SortedSet<LayoutFeature> set = map.get(lv);
return set != null && set.contains(f);
}