本文整理汇总了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);
}