java类com.google.common.collect.Lists的实例源码

BasicKeyChain.java 文件源码 项目:creacoinj 阅读 40 收藏 0 点赞 0 评论 0
/** Returns a list of all ECKeys created after the given UNIX time. */
public List<ECKey> findKeysBefore(long timeSecs) {
    lock.lock();
    try {
        List<ECKey> results = Lists.newLinkedList();
        for (ECKey key : hashToKeys.values()) {
            final long keyTime = key.getCreationTimeSeconds();
            if (keyTime < timeSecs) {
                results.add(key);
            }
        }
        return results;
    } finally {
        lock.unlock();
    }
}
TestSqlStatements.java 文件源码 项目:morf 阅读 32 收藏 0 点赞 0 评论 0
/**
 * Tests the select order by statement (with nulls last) against all {@linkplain SqlDialect}s
 *
 * @throws SQLException in case of error.
 */
@Test
public void testSelectOrderByNullsFirstAscNullsFirstDesc() throws SQLException {
  SelectStatement selectOrderByNullsLastStat = select( field("field1"), field("field2")).from(tableRef("OrderByNullsLastTable")).orderBy(field("field1").nullsFirst(),field("field2").desc().nullsFirst());

  String sql = convertStatementToSQL(selectOrderByNullsLastStat);

  sqlScriptExecutorProvider.get().executeQuery(sql, new ResultSetProcessor<Void>() {

    @Override
    public Void process(ResultSet resultSet) throws SQLException {
      List<String> expectedResultField1 = Lists.newArrayList(null,null,"1", "1","3","3");
      List<String> expectedResultField2 = Lists.newArrayList(null,"3", null,"2","4","3");

      int count = 0;
      while (resultSet.next()) {
        assertEquals("count:"+count,expectedResultField1.get(count), resultSet.getString(1));
        assertEquals("count:"+count,expectedResultField2.get(count), resultSet.getString(2));
        count++;
      }
      return null;
    };
  });
}
RoleSelectorWebControl.java 文件源码 项目:Equella 阅读 31 收藏 0 点赞 0 评论 0
@Override
public void doEdits(SectionInfo info)
{
    final RoleSelectorWebControlModel model = getModel(info);

    if( model.getSelectedRoles() != null )
    {
        final List<String> controlValues = storageControl.getValues();
        controlValues.clear();
        controlValues.addAll(Lists.transform(model.getSelectedRoles(), new Function<SelectedRole, String>()
        {
            @Override
            public String apply(SelectedRole role)
            {
                return role.getUuid();
            }
        }));
    }
}
CommutationEvaluatorJUnitTest.java 文件源码 项目:empiria.player 阅读 38 收藏 0 点赞 0 评论 0
@Test
public void evaluateCorrect() {
    // given
    ExpressionBean bean = new ExpressionBean();

    List<Response> responses = Lists.newArrayList(correctResponse(), correctResponse(), correctResponse(), correctResponse(), correctResponse());
    bean.setTemplate("'0'+'2'+'3'='1'+'4'");
    bean.getResponses().addAll(responses);

    Multiset<Multiset<String>> correctAnswerMultiSet = HashMultiset.create(Lists.<Multiset<String>>newArrayList(
            HashMultiset.create(Lists.newArrayList("answer_1", "answer_4")),
            HashMultiset.create(Lists.newArrayList("answer_0", "answer_2", "answer_3")),
            HashMultiset.create(Lists.newArrayList("answer_0", "answer_2", "answer_3", "answer_1", "answer_4"))));
    bean.setCorectResponses(correctAnswerMultiSet);

    // when
    boolean result = testObj.evaluate(bean);

    // then
    assertThat(result, equalTo(true));
}
DatahubSink.java 文件源码 项目:aliyun-maxcompute-data-collectors 阅读 34 收藏 0 点赞 0 评论 0
private List<String> getPropCols(String propertyString, boolean lowercase) {
    if (StringUtils.isEmpty(propertyString)) {
        logger.warn("Property is empty. property name:" + propertyString);
        return null;
    }
    List<String> propList = Lists.newArrayList();
    String[] propCols = propertyString.split(",");
    for (int i = 0; i < propCols.length; i++) {
        String prop = propCols[i].split("/")[0].trim();
        if (lowercase) {
            prop = prop.toLowerCase();
        }
        propList.add(prop);
    }
    return propList;
}
BonusProviderTest.java 文件源码 项目:empiria.player 阅读 29 收藏 0 点赞 0 评论 0
@Test
public void next_imageBonus_random() {
    // given
    final String asset1 = "bonus1";
    final String asset2 = "bonus2.png";
    final Size size = new Size(1, 2);
    BonusResource bonusResource = createBonus(asset2, size, IMAGE);
    ArrayList<BonusResource> bonuses = Lists.newArrayList(createBonus(asset1, size, SWIFFY), bonusResource);
    BonusAction action = createMockAction(bonuses);
    when(bonusConfig.getActions()).thenReturn(Lists.newArrayList(action));
    when(randomWrapper.nextInt(2)).thenReturn(1);

    BonusWithAsset expected = mock(BonusWithAsset.class);
    when(bonusFactory.createBonus(eq(bonusResource))).thenReturn(expected);

    // when
    Bonus result = bonusProvider.next();

    // then
    verify(bonusFactory).createBonus(bonusResource);
    assertThat(result).isEqualTo(expected);
}
WordnetTokenizer.java 文件源码 项目:mynlp 阅读 30 收藏 0 点赞 0 评论 0
@Override
public LinkedList<MynlpTerm> token(char[] text) {

    // 处理为空的特殊情况
    if (text.length == 0) {
        return Lists.newLinkedList();
    }

    //构建一个空的Wordnet对象
    final Wordnet wordnet = initEmptyWordNet(text);

    wordnetInitializer.initialize(wordnet);

    //选择一个路径出来(第一次不严谨的分词结果)
    Wordpath wordPath = bestPathComputer.select(wordnet);

    for (WordpathProcessor xProcessor : wordPathProcessors) {
        wordPath = xProcessor.process(wordPath);
    }

    return path2TermList(wordPath);
}
ThriftSource.java 文件源码 项目:flume-release-1.7.0 阅读 30 收藏 0 点赞 0 评论 0
@Override
public Status appendBatch(List<ThriftFlumeEvent> events) throws TException {
  sourceCounter.incrementAppendBatchReceivedCount();
  sourceCounter.addToEventReceivedCount(events.size());

  List<Event> flumeEvents = Lists.newArrayList();
  for (ThriftFlumeEvent event : events) {
    flumeEvents.add(EventBuilder.withBody(event.getBody(), event.getHeaders()));
  }

  try {
    getChannelProcessor().processEventBatch(flumeEvents);
  } catch (ChannelException ex) {
    logger.warn("Thrift source %s could not append events to the channel.", getName());
    return Status.FAILED;
  }

  sourceCounter.incrementAppendBatchAcceptedCount();
  sourceCounter.addToEventAcceptedCount(events.size());
  return Status.OK;
}
CustomTrigger.java 文件源码 项目:pnc-repressurized 阅读 35 收藏 0 点赞 0 评论 0
/**
 * Trigger.
 *
 * @param player the player
 */
public void trigger(EntityPlayerMP player) {
    List<ICriterionTrigger.Listener<CustomTrigger.Instance>> list = null;

    for (ICriterionTrigger.Listener<CustomTrigger.Instance> listener : this.listeners) {
        if (listener.getCriterionInstance().test()) {
            if (list == null) {
                list = Lists.newArrayList();
            }

            list.add(listener);
        }
    }

    if (list != null) {
        for (ICriterionTrigger.Listener listener1 : list) {
            listener1.grantCriterion(this.playerAdvancements);
        }
    }
}
DatabaseFullPrunedBlockStore.java 文件源码 项目:creacoinj 阅读 39 收藏 0 点赞 0 评论 0
/**
 * Create a new store for the given {@link org.creativecoinj.core.NetworkParameters}.
 * @param params The network.
 * @throws BlockStoreException If the store couldn't be created.
 */
private void createNewStore(NetworkParameters params) throws BlockStoreException {
    try {
        // Set up the genesis block. When we start out fresh, it is by
        // definition the top of the chain.
        StoredBlock storedGenesisHeader = new StoredBlock(params.getGenesisBlock().cloneAsHeader(), params.getGenesisBlock().getWork(), 0);
        // The coinbase in the genesis block is not spendable. This is because of how Bitcoin Core inits
        // its database - the genesis transaction isn't actually in the db so its spent flags can never be updated.
        List<Transaction> genesisTransactions = Lists.newLinkedList();
        StoredUndoableBlock storedGenesis = new StoredUndoableBlock(params.getGenesisBlock().getHash(), genesisTransactions);
        put(storedGenesisHeader, storedGenesis);
        setChainHead(storedGenesisHeader);
        setVerifiedChainHead(storedGenesisHeader);
    } catch (VerificationException e) {
        throw new RuntimeException(e); // Cannot happen.
    }
}
ConfigServiceWithCacheTest.java 文件源码 项目:apollo-custom 阅读 20 收藏 0 点赞 0 评论 0
@Test
public void testFindLatestActiveReleaseWithReleaseNotFound() throws Exception {
  when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn(null);
  when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn(null);

  Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName,
      someNotificationMessages);
  Release anotherRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName,
      someNamespaceName, someNotificationMessages);

  int retryTimes = 100;

  for (int i = 0; i < retryTimes; i++) {
    configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName,
        someNamespaceName, someNotificationMessages);
  }

  assertNull(release);
  assertNull(anotherRelease);

  verify(releaseMessageService, times(1)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey));
  verify(releaseService, times(1)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName);
}
Codegen.java 文件源码 项目:travny 阅读 33 收藏 0 点赞 0 评论 0
private List<Map<String, Object>> getIdFields(RecordSchema schema) {
    List<Map<String, Object>> list = Lists.newArrayList();
    for (Field f : schema.getFields()) {
        if (f.isRemoved()) {
            continue;
        }
        boolean isIdField = SchemaNameUtils.isIdSchema(schema.getName()) || f.isIdField();
        if (!isIdField) {
            continue;
        }
        Map<String, Object> fm = Maps.newHashMap();
        fm.put("name", f.getName());
        fm.put("isIdField", isIdField);
        list.add(fm);
    }
    return list;
}
RegexBackedCSourceParser.java 文件源码 项目:Reer 阅读 25 收藏 0 点赞 0 评论 0
private List<Include> parseFile(File file) {
    List<Include> includes = Lists.newArrayList();
    try {
        BufferedReader bf = new BufferedReader(new PreprocessingReader(new BufferedReader(new FileReader(file))));

        try {
            String line;
            while ((line = bf.readLine()) != null) {
                Matcher m = includePattern.matcher(line.trim());

                if (m.matches()) {
                    boolean isImport = "import".equals(m.group(1));
                    String value = m.group(2);

                    includes.add(DefaultInclude.parse(value, isImport));
                }
            }
        } finally {
            IOUtils.closeQuietly(bf);
        }
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }

    return includes;
}
SmtpSessionTest.java 文件源码 项目:NioSmtpClient 阅读 38 收藏 0 点赞 0 评论 0
private void assertResponsesMapped(int responsesExpected, CompletableFuture<SmtpClientResponse> future) throws Exception {
  List<SmtpResponse> responses = Lists.newArrayList();
  for (int i = 0; i < responsesExpected; i++) {
    responses.add(new DefaultSmtpResponse(250 + i, "OK " + i));
  }

  responseFuture.complete(responses);

  verify(responseHandler).createResponseFuture(eq(responsesExpected), any());

  assertThat(future.isDone()).isTrue();
  assertThat(future.get().getResponses().size()).isEqualTo(responses.size());

  for (int i = 0; i < responsesExpected; i++) {
    assertThat(future.get().getSession()).isEqualTo(session);
    assertThat(future.get().getResponses().get(i).code()).isEqualTo(responses.get(i).code());
    assertThat(future.get().getResponses().get(i).details()).isEqualTo(responses.get(i).details());
  }
}
ConsumerOperationParameters.java 文件源码 项目:Reer 阅读 56 收藏 0 点赞 0 评论 0
public Builder setLaunchables(Iterable<? extends Launchable> launchables) {
    Set<String> taskPaths = new LinkedHashSet<String>();
    List<InternalLaunchable> launchablesParams = Lists.newArrayList();
    for (Launchable launchable : launchables) {
        Object original = new ProtocolToModelAdapter().unpack(launchable);
        if (original instanceof InternalLaunchable) {
            // A launchable created by the provider - just hand it back
            launchablesParams.add((InternalLaunchable) original);
        } else if (original instanceof TaskListingLaunchable) {
            // A launchable synthesized by the consumer - unpack it into a set of task names
            taskPaths.addAll(((TaskListingLaunchable) original).getTaskNames());
        } else if (launchable instanceof Task) {
            // A task created by a provider that does not understand launchables
            taskPaths.add(((Task) launchable).getPath());
        } else {
            throw new GradleException("Only Task or TaskSelector instances are supported: "
                + (launchable != null ? launchable.getClass() : "null"));
        }
    }
    // Tasks are ignored by providers if launchables is not null
    this.launchables = launchablesParams.isEmpty() ? null : launchablesParams;
    tasks = Lists.newArrayList(taskPaths);
    return this;
}
RuleDescriptionsGenerator.java 文件源码 项目:sonar-css-plugin 阅读 34 收藏 0 点赞 0 评论 0
private String generateHtmlLessFunctionTable(List<StandardFunction> standardFunctions) {
  StringBuilder html = new StringBuilder("<table style=\"border: 0;\">\n");
  List<List<StandardFunction>> subLists = Lists.partition(standardFunctions, 3);
  for (List<StandardFunction> subList : subLists) {
    html.append("<tr>");
    for (StandardFunction standardCssFunction : subList) {
      List<String> links = standardCssFunction.getLinks().stream().filter(f -> f.contains("lesscss.org")).collect(Collectors.toList());
      html.append("<td style=\"border: 0; \">");
      if (!links.isEmpty()) {
        html.append("<a target=\"_blank\" href=\"").append(links.get(0)).append("\">");
      }
      html.append("<code>").append(standardCssFunction.getName()).append("</code>");
      if (!links.isEmpty()) {
        html.append("</a>");
      }
      html.append("</code>");
      for (int i = 1; i < links.size(); i++) {
        html.append("&nbsp;&nbsp;<a target=\"_blank\" href=\"").append(links.get(i)).append("\">#").append(i + 1).append("</a>");
      }
      html.append("</td>\n");
    }
    html.append("</tr>");
  }
  html.append("</table>\n");
  return html.toString();
}
FSAclBaseTest.java 文件源码 项目:hadoop 阅读 38 收藏 0 点赞 0 评论 0
@Test
public void testRemoveAclOnlyDefault() throws IOException {
  FileSystem.mkdirs(fs, path, FsPermission.createImmutable((short)0750));
  List<AclEntry> aclSpec = Lists.newArrayList(
    aclEntry(ACCESS, USER, ALL),
    aclEntry(ACCESS, GROUP, READ_EXECUTE),
    aclEntry(ACCESS, OTHER, NONE),
    aclEntry(DEFAULT, USER, "foo", ALL));
  fs.setAcl(path, aclSpec);
  fs.removeAcl(path);
  AclStatus s = fs.getAclStatus(path);
  AclEntry[] returned = s.getEntries().toArray(new AclEntry[0]);
  assertArrayEquals(new AclEntry[] { }, returned);
  assertPermission((short)0750);
  assertAclFeature(false);
}
PluginLoader.java 文件源码 项目:Elasticsearch 阅读 38 收藏 0 点赞 0 评论 0
private List<CrateComponentLoader.OnModuleReference> loadModuleReferences(Plugin plugin) {
    List<CrateComponentLoader.OnModuleReference> list = Lists.newArrayList();
    for (Method method : plugin.getClass().getDeclaredMethods()) {
        if (!method.getName().equals("onModule")) {
            continue;
        }
        if (method.getParameterTypes().length == 0 || method.getParameterTypes().length > 1) {
            logger.warn("Plugin: {} implementing onModule with no parameters or more than one parameter", plugin.name());
            continue;
        }
        Class moduleClass = method.getParameterTypes()[0];
        if (!Module.class.isAssignableFrom(moduleClass)) {
            logger.warn("Plugin: {} implementing onModule by the type is not of Module type {}", plugin.name(), moduleClass);
            continue;
        }
        method.setAccessible(true);
        //noinspection unchecked
        list.add(new CrateComponentLoader.OnModuleReference(moduleClass, method));
    }

    return list;
}
ColorChoicePropertyEditor.java 文件源码 项目:appinventor-extensions 阅读 47 收藏 0 点赞 0 评论 0
/**
 * Creates a new instance of the property editor.
 *
 * @param hexPrefix  language specific hex number prefix
 * @param colors  colors to be shown in property editor - must not be
 *                {@code null} or empty
 */
public ColorChoicePropertyEditor(final Color[] colors, final String hexPrefix) {
  this.hexPrefix = hexPrefix;
  this.colors = colors;

  // Initialize UI
  List<DropDownItem> choices = Lists.newArrayList();
  for (final Color color : colors) {
    choices.add(new DropDownItem(WIDGET_NAME, color.getHtmlDescription(), new Command() {
      @Override
      public void execute() {
        property.setValue(hexPrefix + color.alphaString + color.rgbString);
      }
    }));
  }
  selectedColorMenu = new DropDownButton(WIDGET_NAME, colors[0].getHtmlDescription(), choices, false,  true, false);

  selectedColorMenu.setStylePrimaryName("ode-ColorChoicePropertyEditor");

  initWidget(selectedColorMenu);
}
PlayerProfileCache.java 文件源码 项目:DecompiledMinecraft 阅读 30 收藏 0 点赞 0 评论 0
private List<PlayerProfileCache.ProfileEntry> getEntriesWithLimit(int limitSize)
{
    ArrayList<PlayerProfileCache.ProfileEntry> arraylist = Lists.<PlayerProfileCache.ProfileEntry>newArrayList();

    for (GameProfile gameprofile : Lists.newArrayList(Iterators.limit(this.gameProfiles.iterator(), limitSize)))
    {
        PlayerProfileCache.ProfileEntry playerprofilecache$profileentry = this.getByUUID(gameprofile.getId());

        if (playerprofilecache$profileentry != null)
        {
            arraylist.add(playerprofilecache$profileentry);
        }
    }

    return arraylist;
}
TestArrowFileReader.java 文件源码 项目:dremio-oss 阅读 28 收藏 0 点赞 0 评论 0
/** Helper method to get the values in given range in colBit vector used in this test class. */
private static List<Boolean> getBitValues(VectorContainer container, int start, int end) {
  FieldReader reader = container.getValueAccessorById(NullableBitVector.class, 0).getValueVector().getReader();

  List<Boolean> values = Lists.newArrayList();
  for(int i=start; i<end; i++) {
    reader.setPosition(i);
    if (reader.isSet()) {
      values.add(reader.readBoolean());
    } else {
      values.add(null);
    }
  }

  return values;
}
RegionReplicaReplicationEndpoint.java 文件源码 项目:ditb 阅读 35 收藏 0 点赞 0 评论 0
@Override
public WALEntryFilter getWALEntryfilter() {
  WALEntryFilter superFilter = super.getWALEntryfilter();
  WALEntryFilter skipReplayedEditsFilter = getSkipReplayedEditsFilter();

  if (superFilter == null) {
    return skipReplayedEditsFilter;
  }

  if (skipReplayedEditsFilter == null) {
    return superFilter;
  }

  ArrayList<WALEntryFilter> filters = Lists.newArrayList();
  filters.add(superFilter);
  filters.add(skipReplayedEditsFilter);
  return new ChainWALEntryFilter(filters);
}
CacheBuilderFactory.java 文件源码 项目:guava-mock 阅读 34 收藏 0 点赞 0 评论 0
/**
 * Sets.cartesianProduct doesn't allow sets that contain null, but we want null to mean
 * "don't call the associated CacheBuilder method" - that is, get the default CacheBuilder
 * behavior. This method wraps the elements in the input sets (which may contain null) as
 * Optionals, calls Sets.cartesianProduct with those, then transforms the result to unwrap
 * the Optionals.
 */
private Iterable<List<Object>> buildCartesianProduct(Set<?>... sets) {
  List<Set<Optional<?>>> optionalSets = Lists.newArrayListWithExpectedSize(sets.length);
  for (Set<?> set : sets) {
    Set<Optional<?>> optionalSet =
        Sets.newLinkedHashSet(Iterables.transform(set, NULLABLE_TO_OPTIONAL));
    optionalSets.add(optionalSet);
  }
  Set<List<Optional<?>>> cartesianProduct = Sets.cartesianProduct(optionalSets);
  return Iterables.transform(cartesianProduct,
      new Function<List<Optional<?>>, List<Object>>() {
        @Override public List<Object> apply(List<Optional<?>> objs) {
          return Lists.transform(objs, OPTIONAL_TO_NULLABLE);
        }
      });
}
MastersListCommand.java 文件源码 项目:athena 阅读 36 收藏 0 点赞 0 评论 0
@Override
protected void execute() {
    ClusterService service = get(ClusterService.class);
    MastershipService mastershipService = get(MastershipService.class);
    List<ControllerNode> nodes = newArrayList(service.getNodes());
    Collections.sort(nodes, Comparators.NODE_COMPARATOR);

    if (outputJson()) {
        print("%s", json(service, mastershipService, nodes));
    } else {
        for (ControllerNode node : nodes) {
            List<DeviceId> ids = Lists.newArrayList(mastershipService.getDevicesOf(node.id()));
            Collections.sort(ids, Comparators.ELEMENT_ID_COMPARATOR);
            print("%s: %d devices", node.id(), ids.size());
            for (DeviceId deviceId : ids) {
                print("  %s", deviceId);
            }
        }
    }
}
BonusProviderTest.java 文件源码 项目:empiria.player 阅读 24 收藏 0 点赞 0 评论 0
@Test
public void next_swiffyBonus() {
    // given
    final String asset = "swiffy0";
    final Size size = new Size(1, 2);
    BonusResource bonusResource = createBonus(asset, size, SWIFFY);
    BonusAction action = createMockAction(Lists.newArrayList(bonusResource));
    when(bonusConfig.getActions()).thenReturn(Lists.newArrayList(action));

    BonusWithAsset expected = mock(BonusWithAsset.class);
    when(bonusFactory.createBonus(eq(bonusResource))).thenReturn(expected);

    // when
    Bonus result = bonusProvider.next();

    // then
    verify(bonusFactory).createBonus(bonusResource);
    assertThat(result).isEqualTo(expected);
}
TriggerServiceWSTest.java 文件源码 项目:oscm 阅读 27 收藏 0 点赞 0 评论 0
public static List<VOParameter> getVOParameters(
        ParameterValueType valueType, String paramValue, String optionId) {
    List<VOParameter> result = getVOParameters(valueType, paramValue);

    VOParameterOption option = new VOParameterOption();
    option.setOptionId(optionId);

    result.get(0).getParameterDefinition()
            .setParameterOptions(Lists.newArrayList(option));

    return result;
}
AReaderImpl.java 文件源码 项目:monarch 阅读 25 收藏 0 点赞 0 评论 0
private static OrcProto.Metadata extractMetadata(ByteBuffer bb, int metadataAbsPos,
    int metadataSize, CompressionCodec codec, int bufferSize) throws IOException {
  bb.position(metadataAbsPos);
  bb.limit(metadataAbsPos + metadataSize);
  return OrcProto.Metadata.parseFrom(InStream.createCodedInputStream("metadata",
      Lists.<DiskRange>newArrayList(new BufferChunk(bb, 0)), metadataSize, codec, bufferSize));
}
PlayerSelector.java 文件源码 项目:BaseClient 阅读 34 收藏 0 点赞 0 评论 0
private static List<Predicate<Entity>> func_179648_b(Map<String, String> p_179648_0_)
{
    List<Predicate<Entity>> list = Lists.<Predicate<Entity>>newArrayList();
    final int i = parseIntWithDefault(p_179648_0_, "lm", -1);
    final int j = parseIntWithDefault(p_179648_0_, "l", -1);

    if (i > -1 || j > -1)
    {
        list.add(new Predicate<Entity>()
        {
            public boolean apply(Entity p_apply_1_)
            {
                if (!(p_apply_1_ instanceof EntityPlayerMP))
                {
                    return false;
                }
                else
                {
                    EntityPlayerMP entityplayermp = (EntityPlayerMP)p_apply_1_;
                    return (i <= -1 || entityplayermp.experienceLevel >= i) && (j <= -1 || entityplayermp.experienceLevel <= j);
                }
            }
        });
    }

    return list;
}
Assembly.java 文件源码 项目:oneops 阅读 28 收藏 0 点赞 0 评论 0
public List<Environment> getEnvironmentList() {
  List<Environment> environmentList = Lists.newArrayList();
  for (Entry<String, Environment> entry : environments.entrySet()) {
    Environment environment = entry.getValue();
    environment.setName(entry.getKey());
    environmentList.add(environment);
  }
  return environmentList;

}
SmtpSession.java 文件源码 项目:NioSmtpClient 阅读 33 收藏 0 点赞 0 评论 0
private CompletableFuture<SmtpClientResponse> sendAsChunked(String from, Collection<String> recipients, MessageContent content, Optional<SendInterceptor> sequenceInterceptor) {
  if (ehloResponse.isSupported(Extension.PIPELINING)) {
    List<Object> objects = Lists.newArrayListWithExpectedSize(3 + recipients.size());
    objects.add(mailCommand(from, recipients));
    objects.addAll(rpctCommands(recipients));

    Iterator<ByteBuf> chunkIterator = content.getContentChunkIterator(channel.alloc());

    ByteBuf firstChunk = chunkIterator.next();
    if (firstChunk == null) {
      throw new IllegalArgumentException("The MessageContent was empty; size is " +
          (content.size().isPresent() ? Integer.toString(content.size().getAsInt()) : "not present"));
    }

    objects.add(getBdatRequestWithData(firstChunk, !chunkIterator.hasNext()));

    return beginSequence(sequenceInterceptor, objects.size(), objects.toArray())
        .thenSendInTurn(getBdatIterator(chunkIterator))
        .toResponses();

  } else {
    SendSequence sequence = beginSequence(sequenceInterceptor, 1, mailCommand(from, recipients));

    for (String recipient : recipients) {
      sequence.thenSend(SmtpRequests.rcpt(recipient));
    }

    return sequence
        .thenSendInTurn(getBdatIterator(content.getContentChunkIterator(channel.alloc())))
        .toResponses();
  }
}


问题


面经


文章

微信
公众号

扫码关注公众号