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:org.psidnell.omnifocus.integrationtest.IntegrationTest.java

private void runMainAndDiff(final String name, String[] extraArgs, boolean doDiff)
        throws Exception, IOException {
    File tmp = new File(tmpDataDir, name);
    String[] args = { "-import", PREVIOUSLY_EXPORTED_DATA_FILE.getPath(), "-o", tmp.getPath() };
    LinkedList<String> combinedArgs = new LinkedList<>();
    combinedArgs.addAll(Arrays.asList(args));
    combinedArgs.addAll(Arrays.asList(extraArgs));
    Main.main(combinedArgs.toArray(new String[combinedArgs.size()]));
    if (doDiff) {
        Diff.diff(new File("src/test/data/" + name), tmp);
    }//from w w w. jav  a2  s  .com
}

From source file:com.espertech.esper.epl.core.ResultSetProcessorSimple.java

/**
 * Applies the select-clause to the given events returning the selected events. The number of events stays the
 * same, i.e. this method does not filter it just transforms the result set.
 * <p>//from   w  w  w . j a v a  2s . c om
 * Also applies a having clause.
 * @param exprProcessor - processes each input event and returns output event
 * @param events - input events
 * @param optionalHavingNode - supplies the having-clause expression
 * @param isNewData - indicates whether we are dealing with new data (istream) or old data (rstream)
 * @param isSynthesize - set to true to indicate that synthetic events are required for an iterator result set
 * @param exprEvaluatorContext context for expression evalauation
 * @return output events, one for each input event
 */
protected static EventBean[] getSelectEventsHaving(SelectExprProcessor exprProcessor, EventBean[] events,
        ExprEvaluator optionalHavingNode, boolean isNewData, boolean isSynthesize,
        ExprEvaluatorContext exprEvaluatorContext) {
    if (events == null) {
        return null;
    }

    LinkedList<EventBean> result = new LinkedList<EventBean>();

    EventBean[] eventsPerStream = new EventBean[1];
    for (EventBean theEvent : events) {
        eventsPerStream[0] = theEvent;

        Boolean passesHaving = (Boolean) optionalHavingNode.evaluate(eventsPerStream, isNewData,
                exprEvaluatorContext);
        if ((passesHaving == null) || (!passesHaving)) {
            continue;
        }

        result.add(exprProcessor.process(eventsPerStream, isNewData, isSynthesize, exprEvaluatorContext));
    }

    if (!result.isEmpty()) {
        return result.toArray(new EventBean[result.size()]);
    } else {
        return null;
    }
}

From source file:ch.zhaw.icclab.tnova.expressionsolver.OTFlyEval.java

String findSum(LinkedList<Double> paramList) {
    Double sum = new Double("0.0");
    for (int i = 0; i < paramList.size(); i++) {
        sum += paramList.get(i);//from   w w w . ja v  a 2  s.com
    }
    return sum.toString();
}

From source file:ch.zhaw.icclab.tnova.expressionsolver.OTFlyEval.java

String findAvg(LinkedList<Double> paramList) {
    Double sum = new Double("0.0");
    for (int i = 0; i < paramList.size(); i++) {
        sum += paramList.get(i);// ww  w . j  a v  a  2 s  . c om
    }
    Double avg = sum / (new Double(paramList.size()));
    return avg.toString();
}

From source file:app.android.kopper.selectmaparea.MapActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    try {/*from w  w  w. j ava2 s  .  co m*/
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_map);
        SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
                .findFragmentById(R.id.map);
        final GoogleMap map = mapFragment.getMap();
        //todo: map is null when no internet connection ??
        if (map != null) {
            map.getUiSettings().setCompassEnabled(false);
            map.getUiSettings().setZoomControlsEnabled(true);
            map.getUiSettings().setIndoorLevelPickerEnabled(false);
            map.getUiSettings().setRotateGesturesEnabled(false);

            map.setOnMapLongClickListener(new GoogleMap.OnMapLongClickListener() {
                @Override
                public void onMapLongClick(LatLng latLng) {
                    createMarker(latLng, map);
                }
            });
            findViewById(R.id.done_button).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    LinkedList<LatLng> positions = getPositions();
                    if (positions.size() != 2)
                        Toast.makeText(getApplicationContext(), getString(R.string.error_two_points),
                                Toast.LENGTH_SHORT).show();
                    else {
                        Intent data = getOrCreateIntent();
                        data.putExtra(SELECTED_POSITIONS, positions);
                        Serializable nextPage = data
                                .getSerializableExtra(MapActivity.class.getCanonicalName() + "-next");
                        if (nextPage != null) {
                            try {
                                Intent ii = new Intent(getApplicationContext(), (Class<?>) nextPage);
                                ii.putExtras(data);
                                startActivityForResult(ii, WIZARD_RESULT_CODE);
                            } catch (Exception e) {
                                LogUtil.e(e);
                            }
                        } else {
                            setResult(RESULT_OK, data);
                            finish();
                        }
                    }
                }
            });
            LinkedList<LatLng> positions = (LinkedList<LatLng>) getLastCustomNonConfigurationInstance();
            if (positions != null) {
                for (int a = 0; a < positions.size(); a++) {
                    createMarker(positions.get(a), map);
                }
            } else {
                Intent intent = getOrCreateIntent();
                Bundle extras = intent.getExtras();
                List<LatLng> selectedPoints = (List<LatLng>) extras.get(SELECTED_POSITIONS);
                if (selectedPoints != null)
                    for (LatLng pos : selectedPoints)
                        createMarker(pos, map);
                map.setOnCameraChangeListener(new GoogleMap.OnCameraChangeListener() {
                    @Override
                    public void onCameraChange(CameraPosition arg0) {
                        map.setOnCameraChangeListener(null);
                        if (markers.size() == 2)
                            map.moveCamera(CameraUpdateFactory.newLatLngBounds(new LatLngBounds(
                                    markers.get(0).getPosition(), markers.get(1).getPosition()), 40));
                        if (markers.size() == 1)
                            map.moveCamera(CameraUpdateFactory.newLatLngZoom(markers.get(0).getPosition(), 10));
                    }
                });
            }
        } else { //no map
            ((TextView) findViewById(R.id.message)).setText(getString(R.string.error_map_load));
        }
    } catch (Exception e) {
        LogUtil.e(e);
    }
}

From source file:ch.zhaw.icclab.tnova.expressionsolver.OTFlyEval.java

String findMin(LinkedList<Double> paramList) {
    Double min = paramList.peekFirst();
    for (int i = 0; i < paramList.size(); i++) {
        if (min > paramList.get(i))
            min = paramList.get(i);//from   w w  w.j ava2  s.  c  o  m
    }
    return min.toString();
}

From source file:ch.zhaw.icclab.tnova.expressionsolver.OTFlyEval.java

String findMax(LinkedList<Double> paramList) {
    Double max = paramList.peekFirst();
    for (int i = 0; i < paramList.size(); i++) {
        if (max < paramList.get(i))
            max = paramList.get(i);//ww w  .  j  a  v  a2s .  c o m
    }
    return max.toString();
}

From source file:vmware.au.se.sqlfireweb.controller.HistoryController.java

@RequestMapping(value = "/history", method = RequestMethod.GET)
public String showHistory(Model model, HttpServletResponse response, HttpServletRequest request,
        HttpSession session) throws Exception {
    if (session.getAttribute("user_key") == null) {
        logger.debug("user_key is null new Login required");
        response.sendRedirect(request.getContextPath() + "/sqlfireweb/login");
        return null;
    }/*w w w  . java 2 s. c  o  m*/

    logger.debug("Received request to show command history");
    UserPref userPref = (UserPref) session.getAttribute("prefs");

    String histAction = request.getParameter("histAction");

    if (histAction != null) {
        logger.debug("histAction = " + histAction);
        // clear history
        session.setAttribute("history", new LinkedList());

        model.addAttribute("historyremoved", "Succesfully cleared history list");
    }

    LinkedList historyList = (LinkedList) session.getAttribute("history");

    int maxsize = userPref.getHistorySize();

    model.addAttribute("historyList", historyList.toArray());
    model.addAttribute("historysize", historyList.size());

    // This will resolve to /WEB-INF/jsp/history.jsp
    return "history";
}

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

public void addHosts(LinkedList<JHost> hsts) {
    int s = hsts.size();
    hosts.clear();/*w w w . j  a v  a  2  s .  c  o  m*/

    if (s > 0) {
        for (int x = 1; x <= s; x++) {
            hosts.put(hsts.get(x - 1).getSiteNumber(), hsts.get(x - 1));

            // numberOfHosts++;
        }
    }
}

From source file:io.github.jeddict.jpa.spec.extend.cache.Cache.java

public void addClass(String _class, LinkedList<String> collection) {
    if (StringUtils.isEmpty(_class)) {
        return;//from   w w  w.  j  av a 2 s  .  co m
    }
    if (collection.contains(_class)) {
        collection.remove(_class);
    }
    while (COLLECTION_SIZE < collection.size()) {
        collection.removeLast();
    }
    collection.addFirst(_class);
}