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


Java ArrayList.addAll方法代碼示例

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


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

示例1: doShortcut

import java.util.ArrayList; //導入方法依賴的package包/類
public void doShortcut() {

        setContentView(R.layout.activity_setup_widget);
        setupAppBar(R.id.toolbar, R.string.widget_creation_title, true, true);
        header = getLayoutInflater().inflate(R.layout.widget_header, null);

        ListView list = (ListView) findViewById(R.id.subs);
        final ArrayList<FeedWrapper> sorted = new ArrayList<FeedWrapper>(Realm.getDefaultInstance().where(Feed.class).findAllSorted("order"));
        sorted.addAll(Realm.getDefaultInstance().where(Category.class).findAllSorted("order"));
        Collections.sort(sorted, new Comparator<FeedWrapper>() {
            @Override
            public int compare(FeedWrapper p1, FeedWrapper p2) {
                return p1.getOrder() - p2.getOrder();// Ascending
            }

        });
        final SideArrayAdapter adapter = new SideArrayAdapter(this, sorted, list);

        list.addHeaderView(header);
        list.setAdapter(adapter);
    }
 
開發者ID:ccrama,項目名稱:Slide-RSS,代碼行數:22,代碼來源:SetupWidget.java

示例2: serialize

import java.util.ArrayList; //導入方法依賴的package包/類
@Override
public Map<String, Object> serialize() {
	Map<String, Object> map = new HashMap<String, Object>();
       map.put("craft", this.craft);
       HashMap<ItemStack, Integer> ofresult = this.result;
       ArrayList<ItemStack> seresult = new ArrayList<ItemStack>();
       seresult.addAll(ofresult.keySet());
       map.put("result.items", seresult);
       ArrayList<Integer> seresultprobs = new ArrayList<Integer>();
       seresultprobs.addAll(ofresult.values());
       map.put("result.probs", seresultprobs);
       map.put("cmds", this.cmds);
       map.put("redstonepower", this.redstonepower);
       map.put("experience", this.experience);
       return map;
}
 
開發者ID:Slaymd,項目名稱:CaulCrafting,代碼行數:17,代碼來源:CraftArray.java

示例3: provideReadWriteRanges

import java.util.ArrayList; //導入方法依賴的package包/類
@Override
public List<ReadWriteRange> provideReadWriteRanges(Bus.BusType busType) {
    ArrayList<ReadWriteRange> readWriteRanges = new ArrayList<ReadWriteRange>();
    switch (busType) {
        case CPU:
            readWriteRanges.add(swappableRoms);
            readWriteRanges.add(fixedRom);
            break;
        case PPU:
            readWriteRanges.add(chrRam);
            readWriteRanges.addAll(nameTableRams);
            readWriteRanges.add(paletteRam);
            break;
    }
    return readWriteRanges;
}
 
開發者ID:gradualgames,項目名稱:ggvm,代碼行數:17,代碼來源:Mapper30.java

示例4: getAttributesWithValue

import java.util.ArrayList; //導入方法依賴的package包/類
public ArrayList<String> getAttributesWithValue(String csParameterName, String csOptionalPrefixed)
{
	ArrayList<String> arrs = null; 
	int n  = 0;
	String csName = getName();
	ValCursor cur = new ValCursor(); 
	String csValue = getFirstNamedVal(cur, csParameterName);
	while(csValue != null)
	{
		ArrayList<String> arr = StringUtil.extractPrefixedKeywords(csValue, csOptionalPrefixed);
		if(arr != null)
		{
			if(arrs == null)
				arrs = new ArrayList<String>();
			arrs.addAll(arr);
		}
		csValue = getNextNamedVal(cur,  csParameterName);
	}
	return arrs; 
}
 
開發者ID:costea7,項目名稱:ChronoBike,代碼行數:21,代碼來源:Tag.java

示例5: ShopItem

import java.util.ArrayList; //導入方法依賴的package包/類
public ShopItem(String id, int cost, String unit) {
    if (ItemManager.itemIdentifierToRPGItemMap.containsKey(id)) {
        this.item = ItemManager.itemIdentifierToRPGItemMap.get(id).generate();
        this.cost = cost;
        ItemStack temp = new ItemStack(item.getType());
        ArrayList<String> lore = new ArrayList<String>();
        if (temp.hasItemMeta() && temp.getItemMeta().hasLore())
            lore.addAll(temp.getItemMeta().getLore());
        lore.add("");
        lore.add(ChatColor.GRAY + "Click to buy this item for " + ChatColor.YELLOW + cost + " " + unit + ChatColor.GRAY + ".");
        ItemMeta im = temp.getItemMeta();
        im.setDisplayName(item.hasItemMeta() && item.getItemMeta().hasDisplayName() ? item.getItemMeta().getDisplayName() : item.getType().toString());
        im.setLore(lore);
        temp.setItemMeta(im);
        display = temp;
    } else {
        try {
            throw new Exception("Could not load shop item with id " + id + " and cost " + cost);
        } catch (Exception e) {
            e.printStackTrace();
        }
        this.item = null;
        this.cost = -1;
        this.display = null;
    }
}
 
開發者ID:edasaki,項目名稱:ZentrelaRPG,代碼行數:27,代碼來源:ShopItem.java

示例6: collectCells

import java.util.ArrayList; //導入方法依賴的package包/類
protected ArrayList<Object> collectCells() {
    ArrayList<Object> cells = new ArrayList<Object>();

    Platform[] platforms = ShareSDK.getPlatformList();
    if (platforms == null) {
        platforms = new Platform[0];
    }
    HashMap<String, String> hides = getHiddenPlatforms();
    if (hides == null) {
        hides = new HashMap<String, String>();
    }
    for (Platform p : platforms) {
        if (!hides.containsKey(p.getName())) {
            cells.add(p);
        }
    }

    ArrayList<CustomerLogo> customers = getCustomerLogos();
    if (customers != null && customers.size() > 0) {
        cells.addAll(customers);
    }

    return cells;
}
 
開發者ID:gaolhjy,項目名稱:cniao5,代碼行數:25,代碼來源:PlatformPage.java

示例7: getLaunchArguments

import java.util.ArrayList; //導入方法依賴的package包/類
@Override
public String[] getLaunchArguments() {
    ArrayList args = (ArrayList)Launch.blackboard.get("ArgumentList");
    if(args.isEmpty()) args.addAll(this.args);

    this.args = null;

    return new String[0];
}
 
開發者ID:Guichaguri,項目名稱:BOHA,代碼行數:10,代碼來源:BlockerTweak.java

示例8: createPluginFactory

import java.util.ArrayList; //導入方法依賴的package包/類
protected PluginFactory createPluginFactory(List<PluginProvider> list) {
    ArrayList<Plugin> plugins = new ArrayList<Plugin>();

    for (PluginProvider suit : list) {
        plugins.addAll(suit.getPlugins());
    }

    plugins.add(new AbstractPlugin() {

        @Override
        public String getName() {
            return "Log";
        }

        @Override
        public Class getFunctionalInterface() {
            return ILog.class;
        }

        @Override
        public Object createFunctionalInterfaceObject(Engine engine,
                                                      IEngine iEngine) {
            return log;
        }
    });

    PluginFactory factory = new PluginFactory(plugins);
    return factory;
}
 
開發者ID:Vitaliy-Yakovchuk,項目名稱:ramus,代碼行數:30,代碼來源:EngineFactory.java

示例9: putAll

import java.util.ArrayList; //導入方法依賴的package包/類
public void putAll(Map< ? extends String, ? extends List<V>> mapToPut) {
    for (String k : mapToPut.keySet()) {
        ArrayList<V> al = new ArrayList<V>();
        al.addAll(mapToPut.get(k));
        getMap().put(k, al);
    }  
}
 
開發者ID:YunlongYang,項目名稱:LightSIP,代碼行數:8,代碼來源:MultiValueMapImpl.java

示例10: copy

import java.util.ArrayList; //導入方法依賴的package包/類
private GUIElement copy(GUIElement object) {
    GUIElement clone = (GUIElement) object.clone();
    ArrayList events = new ArrayList(  );
    events.addAll( object.getEvents() );
    clone.setEvents( events );
    return clone;
}
 
開發者ID:LegendOnline,項目名稱:InventoryAPI,代碼行數:8,代碼來源:ModelLayout.java

示例11: getAllParentMixins

import java.util.ArrayList; //導入方法依賴的package包/類
public static ArrayList<Mixin> getAllParentMixins(Mixin m) {
	ArrayList<Mixin> mixins = new ArrayList<Mixin>();
	for (Mixin m1 : m.getDepends()) {
		mixins.add(m1);
		mixins.addAll(getAllParentMixins(m1));
	}
	return mixins;
}
 
開發者ID:occiware,項目名稱:OCCI-Studio,代碼行數:9,代碼來源:GenUtils.java

示例12: getOrderedChildren

import java.util.ArrayList; //導入方法依賴的package包/類
/** {@inheritDoc} */
public List<XMLObject> getOrderedChildren() {
    ArrayList<XMLObject> children = new ArrayList<XMLObject>();

    if (textContent == null) {
        children.addAll(unknownElements);
    }

    return Collections.unmodifiableList(children);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:11,代碼來源:AttributeValueTypeImpl.java

示例13: removeChannels

import java.util.ArrayList; //導入方法依賴的package包/類
private void removeChannels(ChannelTypeUID channelType) {
    List<Channel> channelList = thing.getChannels();
    ArrayList<Channel> mutableChannelList = new ArrayList<Channel>();
    mutableChannelList.addAll(channelList);
    for (int i = 0; i < mutableChannelList.size(); i++) {
        if (mutableChannelList.get(i).getChannelTypeUID().equals(channelType)) {
            mutableChannelList.remove(i);
            i = 0;
        }
    }

    ThingBuilder thingBuilder = editThing();
    thingBuilder.withChannels(mutableChannelList);
    updateThing(thingBuilder.build());
}
 
開發者ID:Wire82,項目名稱:org.openhab.binding.heos,代碼行數:16,代碼來源:HeosBridgeHandler.java

示例14: getOrderedChildren

import java.util.ArrayList; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
public List<XMLObject> getOrderedChildren() {
    ArrayList<XMLObject> children = new ArrayList<XMLObject>();

    children.addAll(super.getOrderedChildren());
    children.add(protocolMessage);

    return Collections.unmodifiableList(children);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:12,代碼來源:ArtifactResponseImpl.java

示例15: resume

import java.util.ArrayList; //導入方法依賴的package包/類
@Override
public void resume(ExecutionContext context, Object suspendedState)
    throws ResolvedControlThrowable {
  // success: prepend true
  ReturnBuffer rbuf = context.getReturnBuffer();
  ArrayList<Object> result = new ArrayList<>();
  result.add(Boolean.TRUE);
  result.addAll(Arrays.asList(rbuf.getAsArray()));
  rbuf.setToContentsOf(result);
}
 
開發者ID:kroepke,項目名稱:luna,代碼行數:11,代碼來源:BasicLib.java


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