Example usage for java.util LinkedList size

List of usage examples for java.util LinkedList size

Introduction

In this page you can find the example usage for java.util LinkedList size.

Prototype

int size

To view the source code for java.util LinkedList size.

Click Source Link

Usage

From source file:com.asakusafw.runtime.stage.launcher.LauncherOptionsParser.java

private GenericOptionsParser processGenericOptions(LinkedList<String> rest) throws IOException {
    String[] args = rest.toArray(new String[rest.size()]);
    return new GenericOptionsParser(configuration, args);
}

From source file:lv.semti.morphology.webservice.VerbResource.java

private String tagChunk(LinkedList<Word> tokens) {
     LinkedHashSet<String> tags = new LinkedHashSet<String>();
     // da?di minjumi. norm?li bu tikai ar sintakses analzi
     //tags.add(String.valueOf(tokens.size()));
     //tags.add(tokens.get(0).getToken());
     //tags.add(tokens.get(0).getPartOfSpeech());
     if (tokens.size() > 1 && tokens.get(0).isRecognized()
             && tokens.get(0).hasAttribute(AttributeNames.i_PartOfSpeech, AttributeNames.v_Preposition)) {
         // ja fr?ze s?kas ar priev?rdu
         for (Wordform wf : tokens.get(0).wordforms) {
             //tags.add(wf.getDescription());
             if (wf.isMatchingStrong(AttributeNames.i_PartOfSpeech, AttributeNames.v_Preposition)) {
                 String ncase = wf.getValue(AttributeNames.i_Rekcija);
                 if (ncase != null)
                     tags.add(wf.getToken() + caseCode(ncase));
             }//from   w w  w  .  ja  v  a 2 s.  c  o m
         }
     }

     //ja s?kas ar saikli, tad vareetu buut paliigteikums
     if (tokens.size() > 1 && tokens.get(0).isRecognized()
             && tokens.get(0).hasAttribute(AttributeNames.i_PartOfSpeech, AttributeNames.v_Conjunction)) {
         tags.add("S");
     }

     if (tags.isEmpty())
         return tagWord(tokens.getLast(), false); // Ja nesaprat?m, dodam pdj? v?rda analzi - Gunta teica, ka esot ticam?k t?

     return formatJSON(tags);
 }

From source file:com.project.eden.EdenMain.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mainContext = this;

    setProgressBarIndeterminateVisibility(true);

    // start Facebook Login
    Session.openActiveSession(this, true, new Session.StatusCallback() {
        // callback when session changes state
        @Override/* w w  w  . j ava 2  s.c  o m*/
        public void call(Session session, SessionState state, Exception exception) {
            if (session.isOpened()) {

                // make request to the /me API
                Request.executeMyFriendsRequestAsync(session, new Request.GraphUserListCallback() {

                    // callback after Graph API response with user object 
                    public void onCompleted(List<GraphUser> users, Response response) {
                        if (users != null && !users.isEmpty()) {
                            LinkedList<String> friendlist = new LinkedList<String>();
                            for (GraphUser user : users) {
                                String u = "https://graph.facebook.com/" + user.getId() + "/picture?type=large";
                                friendlist.add(u);
                            }
                            String[] listofurls = friendlist.toArray(new String[friendlist.size()]);

                            // friendlist now is a string list of all of your friend's profile pic url 
                            GridView gridview = (GridView) findViewById(R.id.gridview);
                            gridview.setAdapter(new ImageAdapter(mainContext, listofurls));

                        }
                    }
                });
            }
        }
    });
}

From source file:at.bitfire.davdroid.resource.WebDavCollection.java

@SuppressWarnings("unchecked")
public Resource[] multiGet(Resource[] resources)
        throws URISyntaxException, IOException, DavException, HttpException {
    try {/*  ww w. ja  va 2 s.  co  m*/
        if (resources.length == 1)
            return new Resource[] { get(resources[0]) };

        Log.i(TAG, "Multi-getting " + resources.length + " remote resource(s)");

        LinkedList<String> names = new LinkedList<>();
        for (Resource resource : resources)
            names.add(resource.getName());

        LinkedList<T> foundResources = new LinkedList<>();
        collection.multiGet(multiGetType(), names.toArray(new String[names.size()]));
        if (collection.getMembers() == null)
            throw new DavNoContentException();

        for (WebDavResource member : collection.getMembers()) {
            T resource = newResourceSkeleton(member.getName(), member.getProperties().getETag());
            try {
                if (member.getContent() != null) {
                    @Cleanup
                    InputStream is = new ByteArrayInputStream(member.getContent());
                    resource.parseEntity(is, null, getDownloader());
                    foundResources.add(resource);
                } else
                    Log.e(TAG, "Ignoring entity without content");
            } catch (InvalidResourceException e) {
                Log.e(TAG, "Ignoring unparseable entity in multi-response", e);
            }
        }

        return foundResources.toArray(new Resource[foundResources.size()]);
    } catch (InvalidResourceException e) {
        Log.e(TAG, "Couldn't parse entity from GET", e);
    }

    return new Resource[0];
}

From source file:com.alibaba.citrus.turbine.util.CsrfToken.java

/** csrf token?token? */
public String getUniqueToken() {
    HttpSession session = request.getSession();
    String key = getKey();//from w ww .  j  ava  2s.c om
    String tokenOfRequest = (String) request.getAttribute(key);
    int maxTokens = getMaxTokens();

    if (tokenOfRequest == null) {
        // token
        // ?session?token
        // tokentokensession
        // tokentoken
        LinkedList<String> tokens = getTokensInSession(session, key);

        tokenOfRequest = getGenerator().generateUniqueToken();
        request.setAttribute(key, tokenOfRequest);

        tokens.addLast(tokenOfRequest);

        while (tokens.size() > maxTokens) {
            tokens.removeFirst();
        }

        setTokensInSession(session, key, tokens);
    }

    return tokenOfRequest;
}

From source file:com.commander4j.sys.JHostList.java

public String getHTMLmenu(String defaultItem) {
    String selected = "";
    String data = "";
    String result = "";
    LinkedList<JHost> temp = new LinkedList<JHost>();
    JHost hst = new JHost();
    temp = Common.hostList.getHosts();/*  w w w  . ja  va 2  s.  c om*/
    defaultItem = JUtility.replaceNullStringwithBlank(defaultItem);

    checkedIndex = 0;

    if (temp.size() > 0) {

        for (int j = 0; j < temp.size(); j++) {
            hst = (JHost) temp.get(j);

            logger.debug(hst.getSiteNumber() + " " + hst.getSiteDescription());

            if (hst.getEnabled().equals("Y")) {
                if (defaultItem.equals("") == true) {
                    defaultItem = Common.hostList.getHost(String.valueOf(j + 1)).getSiteNumber();
                }

                if (Common.hostList.getHost(String.valueOf(j + 1)).getSiteNumber().equals(defaultItem)) {
                    selected = "checked=\"checked\"";
                    checkedIndex = j;
                } else {
                    selected = "";
                }

                data = "<label><input type=\"radio\" name=\"selectedHost\" value=\"" + hst.getSiteNumber()
                        + "\" " + selected + "/>" + hst.getSiteDescription() + "</label><br/>" + CRLF;
                result = result + data;
            }
        }
    } else {
        checkedIndex = -1;
    }

    return result;
}

From source file:edu.uci.ics.asterix.optimizer.rules.LoadRecordFieldsRule.java

@Override
public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
        throws AlgebricksException {
    AbstractLogicalOperator op1 = (AbstractLogicalOperator) opRef.getValue();
    if (context.checkIfInDontApplySet(this, op1)) {
        return false;
    }//from  w  ww .  ja v  a2 s.co  m

    if (op1.getOperatorTag() == LogicalOperatorTag.ASSIGN) {
        AssignOperator a1 = (AssignOperator) op1;
        ILogicalExpression expr = getFirstExpr(a1);
        if (AnalysisUtil.isAccessToFieldRecord(expr)) {
            boolean res = findAndEliminateRedundantFieldAccess(a1);
            context.addToDontApplySet(this, op1);
            return res;
        }
    }
    exprVisitor.setTopOp(op1);
    exprVisitor.setContext(context);
    boolean res = op1.acceptExpressionTransform(exprVisitor);
    if (!res) {
        context.addToDontApplySet(this, op1);
    }
    if (res && op1.getOperatorTag() == LogicalOperatorTag.SELECT) {
        // checking if we can annotate a Selection as using just one field
        // access
        SelectOperator sigma = (SelectOperator) op1;
        LinkedList<LogicalVariable> vars = new LinkedList<LogicalVariable>();
        VariableUtilities.getUsedVariables(sigma, vars);
        if (vars.size() == 1) {
            // we can annotate Selection
            AssignOperator assign1 = (AssignOperator) op1.getInputs().get(0).getValue();
            AbstractLogicalExpression expr1 = (AbstractLogicalExpression) getFirstExpr(assign1);
            if (expr1.getExpressionTag() == LogicalExpressionTag.FUNCTION_CALL) {
                AbstractFunctionCallExpression f = (AbstractFunctionCallExpression) expr1;
                // f should be a call to a field/data access kind of
                // function
                sigma.getAnnotations().put(AsterixOperatorAnnotations.FIELD_ACCESS, f.getArguments().get(0));
            }
        }
    }

    // TODO: avoid having to recompute type env. here
    if (res) {
        OperatorPropertiesUtil.typeOpRec(opRef, context);
    }
    return res;
}

From source file:modmanager.backend.ModificationOption.java

/**
 * updates the status of contained files in this modification
 *
 * @param status/*from   w w w.  j  a v  a  2  s. c  o  m*/
 */
public void updateStatus(ModificationStatus status) {
    logger.log(Level.INFO, "Updating status of option ...");

    LinkedList<File> installed = getOrLoadInstalledFiles();
    status.set(this, isInstalled(installed), installed.size());

    for (File file : files) {
        /**
         * ! O(n)
         */
        status.set(file, installed.contains(file));
    }
}

From source file:org.openmrs.module.kenyaemr.page.controller.MedicalChartViewPatientPageController.java

/**
  * Remember that this patient was just viewed
  *///from   w  ww .j a  v  a  2  s .  c  o  m
private void recentlyViewed(Patient patient, Session session) {
    LinkedList<Integer> recent = session.getAttribute("kenyaemr.medicalChart.recentlyViewedPatients",
            LinkedList.class);
    if (recent == null) {
        recent = new LinkedList<Integer>();
        session.setAttribute("kenyaemr.medicalChart.recentlyViewedPatients", recent);
    }
    recent.removeFirstOccurrence(patient.getPatientId());
    recent.add(0, patient.getPatientId());
    while (recent.size() > 10)
        recent.removeLast();
}

From source file:com.commander4j.util.JUtility.java

public static JHost getFirtActiveHost() {

    JHost hst = new JHost();
    LinkedList<JHost> temp = Common.hostList.getHosts();
    for (int j = 0; j < temp.size(); j++) {
        hst = (JHost) temp.get(j);/*from  ww  w . j a va 2  s  .c  o  m*/
        if (hst.getEnabled().equals("Y")) {
            if (hst.getDatabaseParameters().getjdbcDriver().equals("http") == false) {
                return hst;
            }
        }
    }
    return hst;
}