java.util.Deque.contains()方法的使用及代码示例

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

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

Deque.contains介绍

[英]Returns true if this deque contains the specified element. More formally, returns true if and only if this deque contains at least one element e such that (o==null ? e==null : o.equals(e)).
[中]如果此数据包含指定的元素,则返回true。更正式地说,当且仅当该deque至少包含一个元素e,使得(o==null?e==null:o.equals(e))返回true。

代码示例

代码示例来源:origin: prestodb/presto

public boolean hasTableInView(Table tableReference)
{
  return tablesForView.contains(tableReference);
}

代码示例来源:origin: google/guava

create().addAll(ImmutableList.of("foo"));
create().clear();
create().contains("foo");
create().containsAll(ImmutableList.of("foo"));
create().equals(new ArrayDeque<>(ImmutableList.of("foo")));

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

@Override
public synchronized boolean contains(Object o) {
  return delegate.contains(o);
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override public boolean contains(Object o) {
  return deque.contains(o);
}

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

@Override public boolean contains(Object object) {
  return q.contains(object);
}

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

private boolean hasBoundBean(Class<?> bean) {
  return this.beans.contains(bean);
}

代码示例来源:origin: org.junit.vintage/junit-vintage-engine

@Override
public boolean shouldRun(Description description) {
  return path.contains(description) || descendants.contains(description);
}

代码示例来源:origin: prestodb/presto

private synchronized void requestComplete(HttpPageBufferClient client)
{
  if (!queuedClients.contains(client)) {
    queuedClients.add(client);
  }
  scheduleRequestIfNecessary();
}

代码示例来源:origin: google/guava

@Override
public boolean contains(Object object) {
 assertTrue(Thread.holdsLock(mutex));
 return delegate.contains(object);
}

代码示例来源:origin: graphql-java/graphql-java

boolean stackContains(TypeInfo typeInfo) {
  return typeStack.contains(typeInfo.getName());
}

代码示例来源:origin: bluelinelabs/Conductor

@NonNull
List<RouterTransaction> popTo(@NonNull RouterTransaction transaction) {
  List<RouterTransaction> popped = new ArrayList<>();
  if (backstack.contains(transaction)) {
    while (backstack.peek() != transaction) {
      RouterTransaction poppedTransaction = pop();
      popped.add(poppedTransaction);
    }
  } else {
    throw new RuntimeException("Tried to pop to a transaction that was not on the back stack");
  }
  return popped;
}

代码示例来源:origin: ben-manes/caffeine

@Test(dataProvider = "empty")
public void contains_withNull(Deque<?> deque) {
 assertThat(deque.contains(null), is(false));
}

代码示例来源:origin: square/dagger

if (path.contains(name)) {
 StringBuilder message = new StringBuilder("Module Inclusion Cycle: ");
 if (path.size() == 1) {

代码示例来源:origin: com.h2database/h2

if (stack.contains(o)) {

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

@Override
public void frameAdded(StreamSinkFrameChannel addedFrame, List<StreamSinkFrameChannel> pendingFrames, Deque<StreamSinkFrameChannel> holdFrames) {
  if (addedFrame.isFinalFragment()) {
    while (true) {
      StreamSinkFrameChannel frame = strictOrderQueue.peek();
      if(frame == null) {
        break;
      }
      if(holdFrames.contains(frame)) {
        if(insertFrame(frame, pendingFrames)) {
          holdFrames.remove(frame);
        } else {
          break;
        }
      } else {
        break;
      }
    }
    while (!holdFrames.isEmpty()) {
      StreamSinkFrameChannel frame = holdFrames.peek();
      if (insertFrame(frame, pendingFrames)) {
        holdFrames.poll();
      } else {
        return;
      }
    }
  }
}

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

/**
 * Check if ident is parameter.
 * @param ast ident to check.
 */
private void checkIdent(DetailAST ast) {
  final Deque<String> currentVariables = getCurrentVariables();
  if (currentVariables != null && !currentVariables.isEmpty()) {
    final DetailAST identAST = ast.getFirstChild();
    if (identAST != null && identAST.getType() == TokenTypes.IDENT
      && getCurrentVariables().contains(identAST.getText())) {
      log(ast, MSG_KEY, identAST.getText());
    }
  }
}

代码示例来源:origin: MovingBlocks/Terasology

region.listener.onMouseLeave());
if (clickedRegion != null && !interactionRegions.contains(clickedRegion)) {
  clickedRegion = null;

代码示例来源:origin: java-json-tools/json-schema-validator

if (schemaURIs.contains(schemaURI))
  throw new ProcessingException(validationLoopMessage(data));
schemaURIs.addLast(schemaURI);

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

/**
 * Queues a new frame to be sent, and attempts a flush if this is the first frame in the new frame queue.
 * <p>
 * Depending on the {@link FramePriority} implementation in use the channel may or may not be added to the actual
 * pending queue
 *
 * @param channel The channel
 */
protected void queueFrame(final S channel) throws IOException {
  assert !newFrames.contains(channel);
  if (isWritesBroken() || !this.channel.getSinkChannel().isOpen() || channel.isBroken() || !channel.isOpen()) {
    IoUtils.safeClose(channel);
    throw UndertowMessages.MESSAGES.channelIsClosed();
  }
  newFrames.add(channel);
  if (!requireExplicitFlush || channel.isBufferFull()) {
    flush();
  }
}

代码示例来源:origin: jankotek/mapdb

/**
 * remove(null), contains(null) always return false
 */
public void testNeverContainsNull() {
  Deque<?>[] qs = {
    new LinkedBlockingDeque<Object>(),
    populatedDeque(2),
  };
  for (Deque<?> q : qs) {
    assertFalse(q.contains(null));
    assertFalse(q.remove(null));
    assertFalse(q.removeFirstOccurrence(null));
    assertFalse(q.removeLastOccurrence(null));
  }
}

相关文章