當前位置: 首頁>>代碼示例>>Java>>正文


Java Iterators.toArray方法代碼示例

本文整理匯總了Java中com.google.common.collect.Iterators.toArray方法的典型用法代碼示例。如果您正苦於以下問題:Java Iterators.toArray方法的具體用法?Java Iterators.toArray怎麽用?Java Iterators.toArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.common.collect.Iterators的用法示例。


在下文中一共展示了Iterators.toArray方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: lookupNames

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
private static void lookupNames(MinecraftServer server, Collection<String> names, ProfileLookupCallback callback)
{
    String[] astring = (String[])Iterators.toArray(Iterators.filter(names.iterator(), new Predicate<String>()
    {
        public boolean apply(String p_apply_1_)
        {
            return !StringUtils.isNullOrEmpty(p_apply_1_);
        }
    }), String.class);

    if (server.isServerInOnlineMode())
    {
        server.getGameProfileRepository().findProfilesByNames(astring, Agent.MINECRAFT, callback);
    }
    else
    {
        for (String s : astring)
        {
            UUID uuid = EntityPlayer.getUUID(new GameProfile((UUID)null, s));
            GameProfile gameprofile = new GameProfile(uuid, s);
            callback.onProfileLookupSucceeded(gameprofile);
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:25,代碼來源:PreYggdrasilConverter.java

示例2: lookupNames

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
private static void lookupNames(MinecraftServer server, Collection<String> names, ProfileLookupCallback callback)
{
    String[] astring = (String[])Iterators.toArray(Iterators.filter(names.iterator(), new Predicate<String>()
    {
        public boolean apply(@Nullable String p_apply_1_)
        {
            return !StringUtils.isNullOrEmpty(p_apply_1_);
        }
    }), String.class);

    if (server.isServerInOnlineMode())
    {
        server.getGameProfileRepository().findProfilesByNames(astring, Agent.MINECRAFT, callback);
    }
    else
    {
        for (String s : astring)
        {
            UUID uuid = EntityPlayer.getUUID(new GameProfile((UUID)null, s));
            GameProfile gameprofile = new GameProfile(uuid, s);
            callback.onProfileLookupSucceeded(gameprofile);
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:25,代碼來源:PreYggdrasilConverter.java

示例3: getListInstalledPlugins

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
public Path[] getListInstalledPlugins() throws IOException {
    if (!Files.exists(environment.pluginsFile())) {
        return new Path[0];
    }

    try (DirectoryStream<Path> stream = Files.newDirectoryStream(environment.pluginsFile())) {
        return Iterators.toArray(stream.iterator(), Path.class);
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:10,代碼來源:PluginManager.java

示例4: createNodes

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@Override
protected Node[] createNodes(Node key) {
    return Iterators.toArray(
            Iterators.transform(
                    Iterators.forArray(super.createNodes(key)),
                    new Function<Node, Node>() {
                @Override
                public Node apply(Node input) {
                    return new NotRootResourceFilterNode(input, project);
                }
            }),
            Node.class);
}
 
開發者ID:NBANDROIDTEAM,項目名稱:NBANDROID-V2,代碼行數:14,代碼來源:AndroidResourceNode.java

示例5: files

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
/**
 * Returns an array of all files in the given directory matching.
 */
public static Path[] files(Path from, DirectoryStream.Filter<Path> filter) throws IOException {
    try (DirectoryStream<Path> stream = Files.newDirectoryStream(from, filter)) {
        return Iterators.toArray(stream.iterator(), Path.class);
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:9,代碼來源:FileSystemUtils.java


注:本文中的com.google.common.collect.Iterators.toArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。