List of usage examples for java.util LinkedList add
public boolean add(E e)
From source file:net.dv8tion.jda.handle.MessageBulkDeleteHandler.java
@Override protected String handleInternally(JSONObject content) { String channelId = content.getString("channel_id"); if (api.isBulkDeleteSplittingEnabled()) { content.getJSONArray("ids").forEach(id -> { new MessageDeleteHandler(api, responseNumber).handle( new JSONObject().put("d", new JSONObject().put("channel_id", channelId).put("id", id))); });/*from w w w.j a v a 2s . c o m*/ } else { TextChannel channel = api.getChannelMap().get(channelId); if (channel != null) { if (GuildLock.get(api).isLocked(channel.getGuild().getId())) { return channel.getGuild().getId(); } LinkedList<String> msgIds = new LinkedList<>(); content.getJSONArray("ids").forEach(id -> msgIds.add((String) id)); api.getEventManager().handle(new MessageBulkDeleteEvent(api, responseNumber, channel, msgIds)); } } return null; }
From source file:edu.csun.ecs.cs.multitouchj.application.chopsticks.ui.GrabbableControl.java
protected List<GestureHandler> getGestureHandlers() { LinkedList<GestureHandler> gestureHandlers = new LinkedList<GestureHandler>(); gestureHandlers.add(new GestureHandlerGrab()); return gestureHandlers; }
From source file:com.github.tncardoso.kloutapi.Klout.java
/** * Shortcut for retrieving one user's klout score. * //from w ww. j a v a 2 s . co m * @param user * to retrieve klout score. * @return retrieved klout score. * @throws KloutException */ public KloutScorePair klout(String user) throws KloutException { LinkedList<String> userlist = new LinkedList<String>(); userlist.add(user); List<KloutScorePair> ret = klout(userlist); return ret.get(0); }
From source file:net.dv8tion.jda.core.handle.MessageBulkDeleteHandler.java
@Override protected Long handleInternally(JSONObject content) { final long channelId = content.getLong("channel_id"); if (api.isBulkDeleteSplittingEnabled()) { SocketHandler handler = api.getClient().getHandler("MESSAGE_DELETE"); content.getJSONArray("ids").forEach(id -> { handler.handle(responseNumber, new JSONObject().put("d", new JSONObject().put("channel_id", Long.toUnsignedString(channelId)).put("id", id))); });/*from w ww .j a v a 2 s . c o m*/ } else { TextChannel channel = api.getTextChannelMap().get(channelId); if (channel == null) { api.getEventCache().cache(EventCache.Type.CHANNEL, channelId, () -> handle(responseNumber, allContent)); EventCache.LOG.debug("Received a Bulk Message Delete for a TextChannel that is not yet cached."); return null; } if (api.getGuildLock().isLocked(channel.getGuild().getIdLong())) { return channel.getGuild().getIdLong(); } LinkedList<String> msgIds = new LinkedList<>(); content.getJSONArray("ids").forEach(id -> msgIds.add((String) id)); api.getEventManager().handle(new MessageBulkDeleteEvent(api, responseNumber, channel, msgIds)); } return null; }
From source file:asciidoc.maven.plugin.cmd.A2x.java
@Override public LinkedList<String> getOptions() { LinkedList<String> options = new LinkedList<String>(); if (stylesheet != null) options.add("--stylesheet=" + this.stylesheet); if (this.icons) { options.add("--icons"); options.add("--icons-dir=" + this.iconsDir); }//from ww w .java2 s . co m if (this.verbose) { options.add("--verbose"); } options.add("-f" + this.format); if (this.traductor != null) { options.add("--" + this.traductor); } if (this.book) options.add("-dbook"); if (this.encoding != null) options.add("-a encoding=" + this.encoding); if (this.lang != null) options.add("-a lang=" + this.lang); options.add("-D" + getOutput().getAbsolutePath()); options.add(this.srcFile.getAbsolutePath()); return options; }
From source file:com.hp.alm.ali.idea.translate.filter.MultipleItemsTranslatedResolver.java
private String resolve(String[] split, Map<String, String> map) { // keep order (don't join values directly) LinkedList<String> list = new LinkedList<String>(); for (String idStr : split) { list.add(map.get(idStr)); }/*ww w . java 2 s. co m*/ return StringUtils.join(list, ";"); }
From source file:com.hp.alm.ali.idea.filter.MultipleItemsFactory.java
@Override public String multipleValues(List<String> values) { LinkedList<String> list = new LinkedList<String>(); for (String value : values) { if (value.isEmpty()) { list.add(MultipleItemsTranslatedResolver.NO_VALUE); } else {/*ww w. j a va 2 s .c o m*/ list.add(value); } } return StringUtils.join(list, ";"); }
From source file:edu.stanford.mobisocial.dungbeetle.feed.objects.ProfilePictureObj.java
public boolean handleObjFromNetwork(Context context, Contact from, JSONObject obj) { byte[] data = FastBase64.decode(obj.optString(DATA)); boolean reply = obj.optBoolean(REPLY); String id = Long.toString(from.id); ContentValues values = new ContentValues(); values.put(Contact.PICTURE, data);/*from w ww .j a v a 2 s.c om*/ context.getContentResolver().update(Uri.parse(DungBeetleContentProvider.CONTENT_URI + "/contacts"), values, "_id=?", new String[] { id }); Helpers.invalidateContacts(); if (reply) { LinkedList<Contact> contacts = new LinkedList<Contact>(); contacts.add(from); Helpers.resendProfile(context, contacts, false); } return false; }
From source file:org.deegree.securityproxy.wfs.responsefilter.capabilities.WfsCapabilitiesModificationManagerCreator.java
private LinkedList<ElementPathStep> createBasePath() { LinkedList<ElementPathStep> path = new LinkedList<ElementPathStep>(); path.add(new ElementPathStep(new QName("http://www.opengis.net/wfs", "WFS_Capabilities"))); path.add(new ElementPathStep(new QName("http://www.opengis.net/ows", "OperationsMetadata"))); path.add(new ElementPathStep(new QName("http://www.opengis.net/ows", "Operation"))); path.add(new ElementPathStep(new QName("http://www.opengis.net/ows", "DCP"))); path.add(new ElementPathStep(new QName("http://www.opengis.net/ows", "HTTP"))); return path;/*from ww w . j a v a2 s. com*/ }
From source file:com.cloud.agent.resource.virtualnetwork.ConfigHelper.java
private static List<ConfigItem> generateConfig(CreateIpAliasCommand cmd) { LinkedList<ConfigItem> cfg = new LinkedList<>(); List<IpAliasTO> ipAliasTOs = cmd.getIpAliasList(); StringBuilder args = new StringBuilder(); for (IpAliasTO ipaliasto : ipAliasTOs) { args.append(ipaliasto.getAlias_count()); args.append(':'); args.append(ipaliasto.getRouterip()); args.append(':'); args.append(ipaliasto.getNetmask()); args.append('-'); }//from w ww. jav a2 s . c om cfg.add(new ScriptConfigItem(VRScripts.IPALIAS_CREATE, args.toString())); return cfg; }