Java Code Examples for java.util.ArrayList.addAll()

The following are Jave code examples for showing how to use addAll() of the java.util.ArrayList class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: BOHA   File: BlockerTweak.java   Source Code and License Vote up 8 votes
@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];
}
 
Example 2
Project: Slide-RSS   File: SetupWidget.java   Source Code and License Vote up 7 votes
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);
    }
 
Example 3
Project: CaulCrafting   File: CraftArray.java   Source Code and License Vote up 7 votes
@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;
}
 
Example 4
Project: ggvm   File: Mapper30.java   Source Code and License Vote up 7 votes
@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;
}
 
Example 5
Project: ChronoBike   File: Tag.java   Source Code and License Vote up 7 votes
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; 
}
 
Example 6
Project: ZentrelaRPG   File: ShopItem.java   Source Code and License Vote up 7 votes
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;
    }
}
 
Example 7
Project: cniao5   File: PlatformPage.java   Source Code and License Vote up 7 votes
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;
}
 
Example 8
Project: ramus   File: EngineFactory.java   Source Code and License Vote up 6 votes
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;
}
 
Example 9
Project: LightSIP   File: MultiValueMapImpl.java   Source Code and License Vote up 6 votes
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);
    }  
}
 
Example 10
Project: InventoryAPI   File: ModelLayout.java   Source Code and License Vote up 6 votes
private GUIElement copy(GUIElement object) {
    GUIElement clone = (GUIElement) object.clone();
    ArrayList events = new ArrayList(  );
    events.addAll( object.getEvents() );
    clone.setEvents( events );
    return clone;
}
 
Example 11
Project: OCCI-Studio   File: GenUtils.java   Source Code and License Vote up 6 votes
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;
}
 
Example 12
Project: lams   File: AttributeValueTypeImpl.java   Source Code and License Vote up 6 votes
/** {@inheritDoc} */
public List<XMLObject> getOrderedChildren() {
    ArrayList<XMLObject> children = new ArrayList<XMLObject>();

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

    return Collections.unmodifiableList(children);
}
 
Example 13
Project: org.openhab.binding.heos   File: HeosBridgeHandler.java   Source Code and License Vote up 6 votes
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());
}
 
Example 14
Project: lams   File: ArtifactResponseImpl.java   Source Code and License Vote up 6 votes
/**
 * {@inheritDoc}
 */
public List<XMLObject> getOrderedChildren() {
    ArrayList<XMLObject> children = new ArrayList<XMLObject>();

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

    return Collections.unmodifiableList(children);
}
 
Example 15
Project: luna   File: BasicLib.java   Source Code and License Vote up 6 votes
@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);
}
 
Example 16
Project: Orin   File: PlaylistAdapter.java   Source Code and License Vote up 6 votes
@NonNull
private ArrayList<Song> getSongList(@NonNull List<Playlist> playlists) {
    final ArrayList<Song> songs = new ArrayList<>();
    for (Playlist playlist : playlists) {
        if (playlist instanceof AbsCustomPlaylist) {
            songs.addAll(((AbsCustomPlaylist) playlist).getSongs(activity));
        } else {
            songs.addAll(PlaylistSongLoader.getPlaylistSongList(activity, playlist.id));
        }
    }
    return songs;
}
 
Example 17
Project: incubator-netbeans   File: DependencyGraphScene.java   Source Code and License Vote up 6 votes
public void setMyZoomFactor(double zoom) {
    setZoomFactor(zoom);
    ArrayList<Widget> arr = new ArrayList<Widget>();
    arr.addAll(mainLayer.getChildren());
    arr.addAll(connectionLayer.getChildren());
    for (Widget wid : arr) {
        if (wid instanceof NodeWidget) {
            ((NodeWidget)wid).updateReadableZoom();
        }
        if (wid instanceof EdgeWidget) {
            ((EdgeWidget)wid).updateReadableZoom();
        }
    }
}
 
Example 18
Project: bicycleSharingServer   File: BicycleController.java   Source Code and License Vote up 5 votes
/**
 * 1.单车列表显示
 *
 * @return bicycle/bicycle_list.jsp
 */
@RequestMapping(value = "admin-bicycle-list-show", method = RequestMethod.GET)
public String listShow(Map<String, Object> requestMap, @RequestParam("page") Integer page) {
    requestMap.put("nav", "bicycle");
    ArrayList<Bicycle> bicycles = (ArrayList<Bicycle>) bicycleService.getAllBicycle();
    requestMap.put("bicycles", bicycles);

    int pageCount = bicycles.size();  //数据条数
    int pageSize = 20;  //分页条数
    int pageMax = pageCount / pageSize;  //最大页数
    int pagePointer = 1;  //当前指向页
    if (pageMax != 0 && pageCount % pageSize != 0) {
        ++pageMax;
    }
    if (pageMax == 0) {
        pageMax = 1;
    }
    if (page < 1 || page > pageMax) {
        pagePointer = 1;
    } else {
        pagePointer = page;
    }
    ArrayList<Bicycle> pageBicycles = new ArrayList<>();
    if (pageMax == 1) {
        pageBicycles.addAll(bicycles);
    } else if (pagePointer == pageMax) {
        int tmp = pageCount % pageSize;
        if (tmp == 0) {
            tmp = pageSize;
        }
        for (int i = pageSize * (pagePointer - 1); i < pageSize * (pagePointer - 1) + tmp; ++i) {
            pageBicycles.add(bicycles.get(i));
        }
    } else {
        for (int i = pageSize * (pagePointer - 1); i < pageSize * pagePointer; ++i) {
            pageBicycles.add(bicycles.get(i));
        }
    }
    requestMap.put("pageMax", pageMax);
    requestMap.put("pagePoint", pagePointer);
    requestMap.put("pageBicycles", pageBicycles);

    return "bicycle/bicycle_list";
}
 
Example 19
Project: IdealMedia   File: IabHelper.java   Source Code and License Vote up 5 votes
int querySkuDetails(String itemType, Inventory inv, List<String> moreSkus)
                            throws RemoteException, JSONException {
    logDebug("Querying SKU details.");
    ArrayList<String> skuList = new ArrayList<String>();
    skuList.addAll(inv.getAllOwnedSkus(itemType));
    if (moreSkus != null) {
        for (String sku : moreSkus) {
            if (!skuList.contains(sku)) {
                skuList.add(sku);
            }
        }
    }

    if (skuList.size() == 0) {
        logDebug("queryPrices: nothing to do because there are no SKUs.");
        return BILLING_RESPONSE_RESULT_OK;
    }

    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);
    Bundle skuDetails = mService.getSkuDetails(3, mContext.getPackageName(),
            itemType, querySkus);

    if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
        int response = getResponseCodeFromBundle(skuDetails);
        if (response != BILLING_RESPONSE_RESULT_OK) {
            logDebug("getSkuDetails() failed: " + getResponseDesc(response));
            return response;
        }
        else {
            logError("getSkuDetails() returned a bundle with neither an error nor a detail list.");
            return IABHELPER_BAD_RESPONSE;
        }
    }

    ArrayList<String> responseList = skuDetails.getStringArrayList(
            RESPONSE_GET_SKU_DETAILS_LIST);

    for (String thisResponse : responseList) {
        SkuDetails d = new SkuDetails(itemType, thisResponse);
        logDebug("Got sku details: " + d);
        inv.addSkuDetails(d);
    }
    return BILLING_RESPONSE_RESULT_OK;
}
 
Example 20
Project: BWDM   File: ArrayListTest.java   Source Code and License Vote up 4 votes
public static void main(String[] args) {

		ArrayList<Integer> al = new ArrayList<Integer>();

		for(int i=0; i<5f; i++) {
			al.add(i);
		}
		al.forEach(p -> { System.out.print(p+","); });
		System.out.println();


		al.addAll(al);
		al.forEach(p -> { System.out.print(p+","); });

	}