List of usage examples for java.util Collections singletonList
public static <T> List<T> singletonList(T o)
From source file:com.cloudbees.demo.beesshop.domain.ProductRepository.java
public List<String> suggestProductKeywords(String query) { return Collections.singletonList("#TODO#"); }
From source file:org.apache.marmotta.ldclient.provider.phpbb.mapping.PHPBBForumHrefMapper.java
@Override public List<Value> map(String resourceUri, Element selectedValue, ValueFactory factory) { String baseUriSite = resourceUri.substring(0, resourceUri.lastIndexOf('/')); String baseUriTopic = baseUriSite + "/viewforum.php?"; try {/*from w w w . java 2 s. c o m*/ URI uri = new URI(selectedValue.absUrl("href")); Map<String, String> params = new HashMap<String, String>(); for (NameValuePair p : URLEncodedUtils.parse(uri, "UTF-8")) { params.put(p.getName(), p.getValue()); } return Collections.singletonList((Value) factory.createURI(baseUriTopic + "f=" + params.get("f"))); } catch (URISyntaxException ex) { throw new RuntimeException("invalid syntax for URI", ex); } }
From source file:com.yahoo.elide.core.exceptions.HttpStatusException.java
public Pair<Integer, JsonNode> getErrorResponse() { Map<String, List<String>> errors = Collections.singletonMap("errors", Collections.singletonList(toString())); return buildResponse(errors); }
From source file:net.dv8tion.discord.commands.MyAnimeListCommand.java
@Override public List<String> getUsageInstructions() { return Collections.singletonList(".mal *<search terms>*\n" + "__Example:__ .mal sao\n" + " - This will return the entry for Sword Art Online.\n" + "__Example 2:__ .mal magi kingdom of magic\n" + " - This will return the entry for Magi - The Kingdom of Magic."); }
From source file:com.vrem.wifianalyzer.wifi.channelavailable.ChannelAvailableAdapterTest.java
@Before public void setUp() { mainActivity = RobolectricUtil.INSTANCE.getActivity(); wiFiChannelCountry = WiFiChannelCountry.get("US"); fixture = new ChannelAvailableAdapter(mainActivity, Collections.singletonList(wiFiChannelCountry)); }
From source file:com.create.controller.BeanValidatorErrorHandler.java
private List<?> getTargets(BindingResult result) { final Object target = result.getTarget(); return target instanceof List ? (List<?>) target : Collections.singletonList(target); }
From source file:net.chrisrichardson.bankingExample.domain.hibernate.HibernateAccountRepositoryMockTests.java
@Test public void testRepository() { Account account = AccountMother.makeAccountWithNoOverdraft(0.0); String accountId = account.getAccountId(); expect(hibernateTemplate.findByNamedQueryAndNamedParam("Account.findAccountByAccountId", "accountId", accountId)).andReturn(Collections.singletonList(account)); replay(hibernateTemplate);/*from ww w . j a va 2 s . c om*/ Account result = repository.findAccount(accountId); assertSame(account, result); }
From source file:com.linkedin.pinot.broker.pruner.SegmentZKMetadataPrunerTest.java
@Test public void testPruner() { SegmentZKMetadata metadata = new OfflineSegmentZKMetadata(); Map<String, ColumnPartitionMetadata> columnPartitionMap = new HashMap<>(); int expectedPartition = 3; columnPartitionMap.put(PARTITION_COLUMN, new ColumnPartitionMetadata(PARTITION_FUNCTION_NAME, NUM_PARTITION, Collections.singletonList(new IntRange(expectedPartition)))); SegmentZKMetadataPrunerService prunerService = new SegmentZKMetadataPrunerService( new String[] { PRUNER_NAME }); SegmentPartitionMetadata segmentPartitionMetadata = new SegmentPartitionMetadata(columnPartitionMap); metadata.setPartitionMetadata(segmentPartitionMetadata); Pql2Compiler compiler = new Pql2Compiler(); for (int actualPartition = 0; actualPartition < NUM_PARTITION; actualPartition++) { String query = "select count(*) from myTable where " + PARTITION_COLUMN + " = " + actualPartition; BrokerRequest brokerRequest = compiler.compileToBrokerRequest(query); SegmentPrunerContext prunerContext = new SegmentPrunerContext(brokerRequest); Assert.assertEquals(prunerService.prune(metadata, prunerContext), (actualPartition != expectedPartition)); }/* w w w . j a v a2 s . c om*/ }
From source file:com.cloudera.cdk.morphline.tika.decompress.UnpackBuilder.java
@Override public Collection<String> getNames() { return Collections.singletonList("unpack"); }
From source file:org.cloudfoundry.tools.timeout.TimeoutResourceHttpRequestHandler.java
public TimeoutResourceHttpRequestHandler() { Resource location = new ClassPathResource("/cloudfoundry/"); setLocations(Collections.singletonList(location)); }