java.util.ArrayDeque.forEach()方法的使用及代码示例

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

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

ArrayDeque.forEach介绍

暂无

代码示例

代码示例来源:origin: apache/incubator-druid

void close()
 {
  synchronized (this) {
   closed = true;
   resourceHolderList.forEach(v -> factory.close(v.getResource()));
   resourceHolderList.clear();
   this.notifyAll();
  }
 }
}

代码示例来源:origin: lettuce-io/lettuce-core

private void onProtectedMode(String message) {
  RedisConnectionException exception = new RedisConnectionException(message);
  endpoint.notifyException(exception);
  if (channel != null) {
    channel.disconnect();
  }
  stack.forEach(cmd -> cmd.completeExceptionally(exception));
  stack.clear();
}

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

public void release() {
  queue.forEach(Recyclable::recycle);
  queue.clear();
}

代码示例来源:origin: com.metamx/java-util

void close()
 {
  synchronized (this) {
   closed = true;
   resourceHolderList.forEach(v -> factory.close(v.getResource()));
   resourceHolderList.clear();
   this.notifyAll();
  }
 }
}

代码示例来源:origin: io.druid/java-util

void close()
 {
  synchronized (this) {
   closed = true;
   resourceHolderList.forEach(v -> factory.close(v.getResource()));
   resourceHolderList.clear();
   this.notifyAll();
  }
 }
}

代码示例来源:origin: org.apache.druid/java-util

void close()
 {
  synchronized (this) {
   closed = true;
   resourceHolderList.forEach(v -> factory.close(v.getResource()));
   resourceHolderList.clear();
   this.notifyAll();
  }
 }
}

代码示例来源:origin: metamx/java-util

void close()
 {
  synchronized (this) {
   closed = true;
   resourceHolderList.forEach(v -> factory.close(v.getResource()));
   resourceHolderList.clear();
   this.notifyAll();
  }
 }
}

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

/**
 * @see com.fasterxml.jackson.databind.JsonDeserializer#deserialize(com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.databind.DeserializationContext)
 */
@Override
public HeaderMap deserialize(JsonParser p, DeserializationContext ctxt)
    throws IOException, JsonProcessingException {
  HeaderMap map = new HeaderMap();
  while (p.nextToken() != JsonToken.END_OBJECT) {
    String name = p.getCurrentName();
    p.nextToken();
    if (p.currentToken().isScalarValue()) {
      map.add(name, p.getValueAsString());
    } else {
      ArrayDeque<String> values = new ArrayDeque<>();
      while (p.nextToken() != JsonToken.END_ARRAY) {
        values.push(p.getValueAsString());
      }
      values.forEach(value -> map.add(name, value));
    }
  }
  return map;
}

代码示例来源:origin: renekrie/querqy

@Override
public ExpandedQuery rewrite(final ExpandedQuery query) {
  final QuerqyQuery<?> userQuery = query.getUserQuery();
  if (userQuery instanceof Query){
    previousTerms = new ArrayDeque<>();
    termsToDelete = new ArrayDeque<>();
    nodesToAdd = new LinkedList<>();
    visit((Query) userQuery);
    // append nodesToAdd to parent query
    nodesToAdd.forEach(node -> {
      final Node parent = node.getParent();
      // TODO: extend BooleanParent? interface so that we don't need this cast?
      if (parent instanceof DisjunctionMaxQuery) {
        ((DisjunctionMaxQuery) parent).addClause((DisjunctionMaxClause) node);
      } else if (parent instanceof BooleanQuery) {
        ((BooleanQuery) parent).addClause((BooleanClause) node);
      } else {
        throw new IllegalStateException("Unknown parent type " + parent.getClass().getName());
      }
    });
    termsToDelete.forEach(this::removeIfNotOnlyChild);
  }
  return query;
}

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

this.metadataTransactions.forEach(t -> candidates.addAll(t.getOperations()));
this.metadataTransactions.clear();
OperationProcessor.this.metadataUpdater.rollback(0);

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

private void onProtectedMode(String message) {
  RedisConnectionException exception = new RedisConnectionException(message);
  endpoint.notifyException(exception);
  if (channel != null) {
    channel.disconnect();
  }
  stack.forEach(cmd -> cmd.completeExceptionally(exception));
  stack.clear();
}

代码示例来源:origin: zhong-j-yu/bayou

rollbacks.forEach( Runnable::run );
serverAgentList=null;
handlers=null;

代码示例来源:origin: kontalk/tigase-server

@Test
public void testNoDelayForIq() {
  OutQueue queue = new OutQueue();
  int start = Integer.MAX_VALUE-10;
  queue.setCounter(start-1);
  
  int packetToAck = start+5;
  
  for (int i=start; i<=Integer.MAX_VALUE && i > 0; i++) {
    try {
      Packet p = Packet.packetInstance(new Element("iq", new String[] { "id", "from", "to" },
          new String[] { String.valueOf(i), "from@example.com", "to@example.com" }));
      queue.append(p);
    } catch (TigaseStringprepException ex) {
      Logger.getLogger(StreamManagementIOProcessorTest.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
  queue.getQueue().forEach((OutQueue.Entry e) ->
      assertFalse(e.getPacketWithStamp().isXMLNSStaticStr(new String[] { "iq", "delay" }, DELAY_XMLNS))
  );
}

代码示例来源:origin: kontalk/tigase-server

assertEquals(5, size);
assertEquals(queue.getQueue().peek().getPacketWithStamp().getElement().getAttributeStaticStr("id"), String.valueOf(packetToAck+1));
queue.getQueue().forEach((OutQueue.Entry e) ->
    assertTrue(e.getPacketWithStamp().isXMLNSStaticStr(DELAY_PATH, DELAY_XMLNS))
);

代码示例来源:origin: kontalk/tigase-server

queue.getQueue().forEach((OutQueue.Entry e) ->
    assertEquals(1, e.getPacketWithStamp().getElement().findChildren((Element el) -> el.getName() == "delay").size())
);        
queue.getQueue().forEach((OutQueue.Entry e) ->
    assertEquals(1, e.getPacketWithStamp().getElement().findChildren((Element el) -> el.getName() == "delay").size())
);        
queue.getQueue().forEach((OutQueue.Entry e) ->
    assertFalse(e.getPacketWithStamp().isXMLNSStaticStr(new String[] { "iq", "delay" }, DELAY_XMLNS))
);

代码示例来源:origin: kontalk/tigase-server

@Test
public void testValidateOutQueueOverflowToZero() {
  OutQueue queue = new OutQueue();
  int start = Integer.MAX_VALUE-10;
  queue.setCounter(start-1);
  
  int packetToAck = start+5;
  
  for (int i=start; i<=Integer.MAX_VALUE && i > 0; i++) {
    try {
      Packet p = Packet.packetInstance(new Element("message", new String[] { "id", "from", "to" },
          new String[] { String.valueOf(i), "from@example.com", "to@example.com" }));
      queue.append(p);
    } catch (TigaseStringprepException ex) {
      Logger.getLogger(StreamManagementIOProcessorTest.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
  queue.ack(packetToAck);
  
  int size = queue.waitingForAck();
  assertEquals(5, size);
  assertEquals(queue.getQueue().peek().getPacketWithStamp().getElement().getAttributeStaticStr("id"), String.valueOf(packetToAck+1));
  queue.getQueue().forEach((OutQueue.Entry e) -> 
      assertTrue(e.getPacketWithStamp().isXMLNSStaticStr(DELAY_PATH, DELAY_XMLNS))
  );
}

相关文章