本文整理匯總了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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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];
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
示例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());
}
示例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);
}
示例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);
}