List of usage examples for java.util Collections EMPTY_LIST
List EMPTY_LIST
To view the source code for java.util Collections EMPTY_LIST.
Click Source Link
From source file:net.sourceforge.processdash.ui.web.psp.TimeLogPhaseWaterfallChart.java
private List getTimeLogEntries() { String path = getPrefix();//from ww w . j av a 2s. c om TimeLog tl = getDashboardContext().getTimeLog(); List result; try { result = Collections.list(tl.filter(path, null, null)); Collections.sort(result); } catch (IOException e) { e.printStackTrace(); result = Collections.EMPTY_LIST; } return result; }
From source file:org.grails.datastore.mapping.simpledb.engine.SimpleDBEntityPersister.java
@Override @SuppressWarnings({ "unchecked", "rawtypes" }) protected List<Object> retrieveAllEntities(PersistentEntity persistentEntity, Iterable<Serializable> keys) { Query query = session.createQuery(persistentEntity.getJavaClass()); if (keys instanceof List) { if (((List) keys).isEmpty()) { return Collections.EMPTY_LIST; }/*w w w . ja va 2 s . co m*/ query.in(persistentEntity.getIdentity().getName(), (List) keys); } else { List<Serializable> keyList = new ArrayList<Serializable>(); for (Serializable key : keys) { keyList.add(key); } if (keyList.isEmpty()) { return Collections.EMPTY_LIST; } query.in(persistentEntity.getIdentity().getName(), keyList); } List<Object> entityResults = new ArrayList<Object>(); Iterator<Serializable> keyIterator = keys.iterator(); Iterator<Object> listIterator = query.list().iterator(); while (keyIterator.hasNext() && listIterator.hasNext()) { Serializable key = keyIterator.next(); Object next = listIterator.next(); if (next instanceof SimpleDBNativeItem) { entityResults .add(createObjectFromNativeEntry(getPersistentEntity(), key, (SimpleDBNativeItem) next)); } else { entityResults.add(next); } } return entityResults; }
From source file:net.chrisrichardson.foodToGo.domain.hibernate.HibernateRestaurantRepositoryImplMockTest.java
public void testIsRestaurantAvailable_No() { Address deliveryAddress = new Address("1 somewhere", null, "Oakland", "CA", "94619"); Date deliveryTime = makeDeliveryTime(EXPECTED_DAY_OF_WEEK, EXPECTED_HOUR, EXPECTED_MINUTE); mockHibernateTemplate.expects(once()).method("findByNamedQueryAndNamedParam") .with(eq("findAvailableRestaurants"), eq(expectedNames), eq(expectedValues)) .will(returnValue(Collections.EMPTY_LIST)); assertFalse(repository.isRestaurantAvailable(deliveryAddress, deliveryTime)); }
From source file:com.expedia.seiso.web.hateoas.link.PaginationLinkBuilderTests.java
private PaginationLinkBuilder paginationLinkBuilder(int pageNumber, int pageSize, int totalItems) { val pageable = new PageRequest(pageNumber, pageSize); val page = new PageImpl(Collections.EMPTY_LIST, pageable, totalItems); return new PaginationLinkBuilder(page, uriComponents, params); }
From source file:com.ewcms.core.site.web.AclAction.java
public void query() { Channel channel = siteFac.getChannel(id); Acl acl = siteFac.findAclOfChannel(channel); if (acl == null || acl.getEntries() == null) { renderObject(new DataGrid(0, Collections.EMPTY_LIST)); return;//from w w w .j a v a 2 s . co m } List<Map<String, Object>> items = permissionItems(acl.getEntries(), acl.isEntriesInheriting()); renderObject(new DataGrid(items.size(), items)); }
From source file:ch.puzzle.itc.mobiliar.business.auditview.control.AuditService.java
@SuppressWarnings("unchecked") public List<Object> getAllDeletedEntities(Class clazz) { Objects.requireNonNull(clazz, "Clazz can not be null"); AuditReader reader = AuditReaderFactory.get(entityManager); if (reader.isEntityClassAudited(clazz)) { AuditQuery query = reader.createQuery().forRevisionsOfEntity(clazz, false, true) .add(AuditEntity.revisionType().eq(DEL)); List<Object[]> resultList = query.getResultList(); if (!resultList.isEmpty()) { List<Object> deleted = new ArrayList<>(); for (Object[] objects : resultList) { deleted.add(objects[0]); }/*from ww w. j ava2s .co m*/ return deleted; } } return Collections.EMPTY_LIST; }
From source file:jef.database.query.QueryImpl.java
@SuppressWarnings("unchecked") public Collection<OrderField> getOrderBy() { if (orderBy == null) return Collections.EMPTY_LIST; return orderBy; }
From source file:com.gargoylesoftware.htmlunit.html.HtmlAnchorTest.java
/** * @throws Exception if the test fails// ww w . j ava 2 s.c o m */ @Test public void click_onClickHandler_returnFalse() throws Exception { final String firstContent = "<html><head><title>First</title></head><body>\n" + "<a href='http://www.foo1.com' id='a1'>link to foo1</a>\n" + "<a href='" + URL_SECOND + "' id='a2' " + "onClick='alert(\"clicked\");return false;'>link to foo2</a>\n" + "<a href='http://www.foo3.com' id='a3'>link to foo3</a>\n" + "</body></html>"; final String secondContent = "<html><head><title>Second</title></head><body></body></html>"; final WebClient client = getWebClient(); final List<String> collectedAlerts = new ArrayList<>(); client.setAlertHandler(new CollectingAlertHandler(collectedAlerts)); final MockWebConnection webConnection = new MockWebConnection(); webConnection.setResponse(URL_FIRST, firstContent); webConnection.setResponse(URL_SECOND, secondContent); client.setWebConnection(webConnection); final HtmlPage page = client.getPage(URL_FIRST); final HtmlAnchor anchor = page.getHtmlElementById("a2"); assertEquals(Collections.EMPTY_LIST, collectedAlerts); final HtmlPage secondPage = anchor.click(); assertEquals(new String[] { "clicked" }, collectedAlerts); assertSame(page, secondPage); }
From source file:io.druid.query.lookup.LookupSnapshotTakerTest.java
@Test public void tesLookupPullingFromEmptyFile() throws IOException { File snapshotFile = lookupSnapshotTaker.getPersistFile(); Assert.assertTrue(snapshotFile.createNewFile()); Assert.assertEquals(Collections.EMPTY_LIST, lookupSnapshotTaker.pullExistingSnapshot()); }
From source file:de.hybris.platform.subscriptionservices.interceptor.impl.AbstractOrderLoadInterceptorTest.java
private void setupCarts() { masterCart = new CartModel(); final BillingTimeModel billingTimePayNow = new BillingTimeModel(); billingTimePayNow.setCode("paynow"); billingTimePayNow.setOrder(Integer.valueOf(0)); masterCart.setBillingTime(billingTimePayNow); childCartMonthly = new CartModel(); final BillingTimeModel billingTimeMonthly = new BillingTimeModel(); billingTimeMonthly.setCode("monthly"); billingTimeMonthly.setOrder(Integer.valueOf(1)); childCartMonthly.setBillingTime(billingTimeMonthly); childCartMonthly.setParent(masterCart); childCartMonthly.setChildren(Collections.EMPTY_LIST); childCartQuarterly = new CartModel(); final BillingTimeModel billingTimeQuarterly = new BillingTimeModel(); billingTimeQuarterly.setCode("quarterly"); billingTimeQuarterly.setOrder(Integer.valueOf(2)); childCartQuarterly.setBillingTime(billingTimeQuarterly); childCartQuarterly.setParent(masterCart); childCartQuarterly.setChildren(Collections.EMPTY_LIST); childCartYearly = new CartModel(); final BillingTimeModel billingTimeYearly = new BillingTimeModel(); billingTimeYearly.setCode("yearly"); billingTimeYearly.setOrder(Integer.valueOf(3)); childCartYearly.setBillingTime(billingTimeYearly); childCartYearly.setParent(masterCart); childCartYearly.setChildren(Collections.EMPTY_LIST); }