Package java.util

Examples of java.util.List.subList()


            foundNames.add(e.getName());
        }
        q.closeAll();
        pm.currentTransaction().commit();
        pm.close();
        assertEquals("not expected result", expectedNames.subList(2, 4), foundNames);
    }
    public void testNullEqualityWithPrimitive() {
        PersistenceManager pm = pmf.getPersistenceManager();
        Query q = pm.newQuery(Group.class);
        q.setFilter("name != null");
View Full Code Here


          sublist.add(entries[j]);
        }
      }
      Collections.sort(sublist);
      if (sublist.size() > MAX_SIZE) {
        sublist = sublist.subList(0, MAX_SIZE);
      }
      list.addAll(sublist);
      sublist.clear();
    }
    for (int i=0; i<list.size(); i++) {
View Full Code Here

        // sort the hits
        Collections.sort(mdhList, iv_mdhComparator);

        // truncate off the hits
        mdhList.subList(iv_mdhCount, mdhList.size()).clear();
       
        return mdhList;
    }
}
View Full Code Here

            if (userList.size() > numberPerPage)
            {
                int numberOfPages = (int) ((userList.size() - 1 + numberPerPage) / numberPerPage);
                int from = (currentPage - 1) * numberPerPage;
                int to = Math.min(currentPage * numberPerPage,userList.size());
                context.put(SecurityConstants.CONTEXT_USERS, userList.subList(from, to));

                //now build a set of links to access each page (assumed we will show all links)
                StringBuffer pageLinks = new StringBuffer("page: ");
                for (int i = 1; i <= numberOfPages; i++)
                {
View Full Code Here

            boolean del = r.nextBoolean();
            int pos = r.nextInt(result.size() + 1);
            int len = Math.min(result.size() - pos, 1 + r.nextInt(4));
            if (del && result.size() > 0)
            { // delete
                result.subList(pos, pos + len).clear();
            }
            else
            {
                for (int k = 0; k < len; k++, pos++)
                {
View Full Code Here

            if (userList.size() > numberPerPage)
            {
                int numberOfPages = (int) ((userList.size() - 1 + numberPerPage) / numberPerPage);
                int from = (currentPage - 1) * numberPerPage;
                int to = Math.min(currentPage * numberPerPage,userList.size());
                context.put(SecurityConstants.CONTEXT_USERS, userList.subList(from, to));

                //now build a set of links to access each page (assumed we will show all links)
                StringBuffer pageLinks = new StringBuffer("page: ");
                for (int i = 1; i <= numberOfPages; i++)
                {
View Full Code Here

            if (userList.size() > numberPerPage)
            {
                int numberOfPages = (int) ((userList.size() - 1 + numberPerPage) / numberPerPage);
                int from = (currentPage - 1) * numberPerPage;
                int to = Math.min(currentPage * numberPerPage,userList.size());
                context.put(SecurityConstants.CONTEXT_USERS, userList.subList(from, to));

                //now build a set of links to access each page (assumed we will show all links)
                StringBuffer pageLinks = new StringBuffer("page: ");
                for (int i = 1; i <= numberOfPages; i++)
                {
View Full Code Here

       
        if(value instanceof List) {
            List list = (List) value;
           
            if(toIndex >= fromIndex) {
                Collections.rotate(list.subList(fromIndex, toIndex + 1), -1);
            }
            else {
                Collections.rotate(list.subList(toIndex, fromIndex + 1), 1);
            }           
        }
View Full Code Here

           
            if(toIndex >= fromIndex) {
                Collections.rotate(list.subList(fromIndex, toIndex + 1), -1);
            }
            else {
                Collections.rotate(list.subList(toIndex, fromIndex + 1), 1);
            }           
        }
        else {
            LOGGER.info("Row reordering is only available for list backed datatables, use rowReorder ajax behavior with listener for manual handling of model update.");
        }    
View Full Code Here

        AutoComplete ac = (AutoComplete) component;
        List results = ac.getSuggestions();
        int maxResults = ac.getMaxResults();
       
        if(maxResults != Integer.MAX_VALUE && results.size() > maxResults) {
            results = results.subList(0, ac.getMaxResults());
        }

        encodeSuggestions(context, ac, results);
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.