本文整理匯總了Java中java.util.Deque.contains方法的典型用法代碼示例。如果您正苦於以下問題:Java Deque.contains方法的具體用法?Java Deque.contains怎麽用?Java Deque.contains使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.Deque
的用法示例。
在下文中一共展示了Deque.contains方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doBuildResolvedResult
import java.util.Deque; //導入方法依賴的package包/類
private List<DependentBinariesResolvedResult> doBuildResolvedResult(final NativeBinarySpecInternal target, State state, Deque<NativeBinarySpecInternal> stack) {
if (stack.contains(target)) {
onCircularDependencies(state, stack, target);
}
List<DependentBinariesResolvedResult> result = resultsCache.getIfPresent(target);
if (result != null) {
return result;
}
stack.push(target);
result = Lists.newArrayList();
List<NativeBinarySpecInternal> dependents = state.getDependents(target);
for (NativeBinarySpecInternal dependent : dependents) {
List<DependentBinariesResolvedResult> children = doBuildResolvedResult(dependent, state, stack);
result.add(new DefaultDependentBinariesResolvedResult(dependent.getId(), dependent.getProjectScopedName(), dependent.isBuildable(), isTestSuite(dependent), children));
}
stack.pop();
resultsCache.put(target, result);
return result;
}
示例2: checkCycles
import java.util.Deque; //導入方法依賴的package包/類
public static boolean checkCycles(Node node, Deque<Node> path) {
Iterator iter = node.getChildren().iterator();
while (iter.hasNext()) {
Node child = (Node)iter.next();
if (path.contains(child)) {
return true;
}
else {
path.push(child);
if (checkCycles(child, path)==true) {
return true;
}
else {
path.pop();
}
}
}
return false;
}
示例3: visit
import java.util.Deque; //導入方法依賴的package包/類
private void visit(ResourcePoolModule node,
Deque<ResourcePoolModule> visited,
Deque<ResourcePoolModule> done) {
if (visited.contains(node)) {
if (!done.contains(node)) {
throw new IllegalArgumentException("Cyclic detected: " +
node + " " + edges.get(node.name()));
}
return;
}
visited.add(node);
edges.get(node.name())
.forEach(x -> visit(x, visited, done));
done.add(node);
result.addLast(node);
}
示例4: extractThriftStructMetadata
import java.util.Deque; //導入方法依賴的package包/類
private ThriftStructMetadata extractThriftStructMetadata(Type structType)
{
requireNonNull(structType, "structType is null");
Deque<Type> stack = this.stack.get();
if (stack.contains(structType)) {
String path = Stream.concat(stack.stream(), Stream.of(structType))
.map(type -> TypeToken.of(type).getRawType().getName())
.collect(joining("->"));
throw new IllegalArgumentException(
"Circular references must be qualified with 'isRecursive' on a @ThriftField annotation in the cycle: " + path);
}
else {
stack.push(structType);
try {
ThriftStructMetadataBuilder builder = new ThriftStructMetadataBuilder(this, structType);
return builder.build();
}
finally {
Type top = stack.pop();
checkState(
structType.equals(top),
"ThriftCatalog circularity detection stack is corrupt: expected %s, but got %s",
structType,
top);
}
}
}
示例5: extractThriftUnionMetadata
import java.util.Deque; //導入方法依賴的package包/類
private ThriftStructMetadata extractThriftUnionMetadata(Type unionType)
{
requireNonNull(unionType, "unionType is null");
Deque<Type> stack = this.stack.get();
if (stack.contains(unionType)) {
String path = Stream.concat(stack.stream(), Stream.of(unionType))
.map(type -> TypeToken.of(type).getRawType().getName())
.collect(joining("->"));
throw new IllegalArgumentException(
"Circular references must be qualified with 'isRecursive' on a @ThriftField annotation in the cycle: " + path);
}
stack.push(unionType);
try {
ThriftUnionMetadataBuilder builder = new ThriftUnionMetadataBuilder(this, unionType);
return builder.build();
}
finally {
Type top = stack.pop();
checkState(
unionType.equals(top),
"ThriftCatalog circularity detection stack is corrupt: expected %s, but got %s",
unionType,
top);
}
}
示例6: _stackContains
import java.util.Deque; //導入方法依賴的package包/類
private static boolean _stackContains(Deque<?> stack, Object value)
{
if (stack == null)
return false;
return stack.contains(value);
}
示例7: stringToDumpFileHistory
import java.util.Deque; //導入方法依賴的package包/類
public static Deque<File> stringToDumpFileHistory(String preference, boolean allowDirs) {
String[] coordStrings = preference.split(DbInfo.DELIM_ENTRY);
Deque<File> paths = new LinkedList<>();
for (String path : coordStrings){
File f = new File(path);
if (f.exists() && !paths.contains(f) && (allowDirs || !f.isDirectory())) {
paths.add(f);
}
}
return paths;
}
示例8: getFieldList
import java.util.Deque; //導入方法依賴的package包/類
private static void getFieldList(Class clazz, List<String> fieldList, String prefix, Deque<Class> classStack) throws IntrospectionException {
//To avoid recursion, bail out if the input Class has already been introspected
if (classStack.contains(clazz)) {
if (log.isDebugEnabled())
log.debug("Fields from " + clazz + " prefixed by " + prefix + " will be ignored, since the class has already been introspected as per the stack " + classStack);
return;
} else
classStack.addFirst(clazz);
//Introspect the input Class
BeanInfo beanInfo = Introspector.getBeanInfo(clazz);
if (beanInfo != null) {
PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors();
if (pds != null) {
for (PropertyDescriptor pd : pds) {
if (pd.getReadMethod() != null && pd.getWriteMethod() != null) {
String name = pd.getName();
String qualifieldName = prefix == null || prefix.length() == 0 ? name : prefix + '.' + name;
Class type = pd.getPropertyType();
if (type.isArray())
type = type.getComponentType();
if (type == String.class || type == Boolean.class || Number.class.isAssignableFrom(type) || IDateBase.class.isAssignableFrom(type) || Currency.class.isAssignableFrom(type) || type.isPrimitive() || type.isEnum())
fieldList.add(qualifieldName);
else
getFieldList(type, fieldList, qualifieldName, classStack);
}
}
}
}
classStack.removeFirst();
}
示例9: sort
import java.util.Deque; //導入方法依賴的package包/類
private void sort() {
Deque<T> visited = new LinkedList<>();
Deque<T> done = new LinkedList<>();
T node;
while ((node = nodes.poll()) != null) {
if (!visited.contains(node)) {
visit(node, visited, done);
}
}
}
示例10: visit
import java.util.Deque; //導入方法依賴的package包/類
private void visit(T node, Deque<T> visited, Deque<T> done) {
if (visited.contains(node)) {
if (!done.contains(node)) {
throw new IllegalArgumentException("Cyclic detected: " +
node + " " + graph.edges().get(node));
}
return;
}
visited.add(node);
graph.edges().get(node).stream()
.forEach(x -> visit(x, visited, done));
done.add(node);
result.addLast(node);
}
示例11: build
import java.util.Deque; //導入方法依賴的package包/類
private synchronized void build() {
if (!result.isEmpty() || nodes.isEmpty())
return;
Deque<ResourcePoolModule> visited = new LinkedList<>();
Deque<ResourcePoolModule> done = new LinkedList<>();
ResourcePoolModule node;
while ((node = nodes.poll()) != null) {
if (!visited.contains(node)) {
visit(node, visited, done);
}
}
}