Java Code Examples for java.util.Collections.emptyList()

The following are Jave code examples for showing how to use emptyList() of the java.util.Collections class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: lams   File: BaseSAML1MessageEncoder.java   View Source Code Vote up 5 votes
/**
 * Sets the list of list of schemes allowed to appear in URLs related to the encoded message. Note, the appearance
 * of schemes such as 'javascript' may open the system up to attacks (e.g. cross-site scripting attacks).
 * 
 * @param schemes URL schemes allowed to appear in a message
 */
public void setAllowedURLSchemes(String[] schemes) {
    if (schemes == null || schemes.length == 0) {
        allowedURLSchemes = Collections.emptyList();
    } else {
        List<String> temp = new ArrayList<String>();
        for (String scheme : schemes) {
            temp.add(scheme);
        }
        allowedURLSchemes = Collections.unmodifiableList(temp);
    }
}
 
Example 2
Project: CorePatch   File: PreDiffPlanTest.java   View Source Code Vote up 5 votes
@Test(expected = IllegalArgumentException.class)
public void testConstructor_NewFileRecompressionOrderNotOK() {
  new PreDiffPlan(
      Collections.<QualifiedRecommendation>emptyList(),
      SORTED_VOID_LIST,
      SORTED_DEFLATE_LIST,
      reverse(SORTED_DEFLATE_LIST));
}
 
Example 3
Project: lokalized-java   File: Range.java   View Source Code Vote up 5 votes
/**
 * Creates a range with the given values and "infinite" flag.
 *
 * @param values   the values that comprise this range, may be null
 * @param infinite whether this range is infinite - that is, whether the range's pattern repeats indefinitely, not null
 */
private Range(@Nullable T[] values, @Nonnull Boolean infinite) {
  requireNonNull(values);
  requireNonNull(infinite);

  this.values = values == null ? Collections.emptyList() : Collections.unmodifiableList(Arrays.asList(values));
  this.infinite = infinite;
}
 
Example 4
Project: airsonic   File: PlaylistServiceTestImport.java   View Source Code Vote up 5 votes
@Before
public void setup() {
    playlistService = new PlaylistService(
            mediaFileDao,
            playlistDao,
            securityService,
            settingsService,
            Collections.emptyList(),
            Lists.newArrayList(defaultPlaylistImportHandler));

}
 
Example 5
Project: oscm   File: MarketableServicePublishCtrl.java   View Source Code Vote up 5 votes
private void initializeCategories(String marketplaceId) {
    List<VOCategory> allMarketplaceCategories = Collections.emptyList();
    POMarketplacePriceModel marketplacePriceModel = null;
    POPartnerPriceModel partnerPriceModel = null;
    model.setMarketplacePriceModel(null);
    if (!ADMStringUtils.isBlank(marketplaceId)) {
        Response response;
        try {
            response = getPublishService().getCategoriesAndRvenueShare(
                    marketplaceId, getUserLanguage());
            allMarketplaceCategories = response
                    .getResultList(VOCategory.class);
            marketplacePriceModel = response
                    .getResult(POMarketplacePriceModel.class);
            partnerPriceModel = response
                    .getResult(POPartnerPriceModel.class);
        } catch (ObjectNotFoundException e) {
            ui.handleException(e);
        }
    }
    model.initializeMarketplaceCategories(allMarketplaceCategories);
    model.setMarketplacePriceModel(marketplacePriceModel == null
            ? new POMarketplacePriceModel() : marketplacePriceModel);
    model.setMarketplacePartnerPriceModel(partnerPriceModel == null
            ? new POPartnerPriceModel() : partnerPriceModel);
    initializeLists(marketplaceId, partnerPriceModel);
}
 
Example 6
Project: GitHub   File: ArrayEmptyList1000Encode.java   View Source Code Vote up 5 votes
@SuppressWarnings("rawtypes")
public ArrayEmptyList1000Encode(){
    super("ArrayEmptyList1000Encode");

    List[] array = new List[1000];
    for (int i = 0; i < array.length; ++i) {
        array[i] = Collections.emptyList();
    }
    this.object = array;
}
 
Example 7
Project: digdes-2017-file-finder   File: BasicZipCrawler.java   View Source Code Vote up 5 votes
private List<DetectedString> crawlZipEntry(ZipFile zipFile, ZipEntry zipEntry) throws IOException {
    if (!zipEntry.isDirectory()) {
        InputStream is = zipFile.getInputStream(zipEntry);
        String filename = zipEntry.getName();
        // TODO invent something better
        if (filename.endsWith(".xml")) {
            return (xmlCrawler.crawl(is)
                    .stream()
                    .map(fileStageBuilder -> fileStageBuilder.inZip(zipFile, filename))
                    .collect(Collectors.toList()));
        }
    }
    return Collections.emptyList();
}
 
Example 8
Project: OperatieBRP   File: RedenEindeRelatieController.java   View Source Code Vote up 5 votes
/**
 * Constructor.
 * @param repository repository
 */
@Inject
protected RedenEindeRelatieController(@Named("redenEindeRelatieRepository") final ReadWriteRepository<RedenBeeindigingRelatie, Short> repository) {
    super(repository,
            Arrays.asList(
                    new Filter<>(OMSCHRIJVING, new StringValueAdapter(), new LikePredicateBuilderFactory(OMSCHRIJVING)),
                    new Filter<>(CODE, new ShortValueAdapter(), new EqualPredicateBuilderFactory(CODE))),
            Collections.emptyList(),
            Arrays.asList(CODE, OMSCHRIJVING));
}
 
Example 9
Project: minikube-build-tools-for-java   File: JsonTemplateMapperTest.java   View Source Code Vote up 5 votes
@Test
public void testWriteJson() throws DigestException, IOException, URISyntaxException {
  Path jsonFile = Paths.get(Resources.getResource("json/basic.json").toURI());
  String expectedJson = new String(Files.readAllBytes(jsonFile), StandardCharsets.UTF_8);

  TestJson testJson = new TestJson();
  testJson.number = 54;
  testJson.text = "crepecake";
  testJson.digest =
      DescriptorDigest.fromDigest(
          "sha256:8c662931926fa990b41da3c9f42663a537ccd498130030f9149173a0493832ad");
  testJson.innerObject = new TestJson.InnerObject();
  testJson.innerObject.number = 23;
  testJson.innerObject.texts = Arrays.asList("first text", "second text");
  testJson.innerObject.digests =
      Arrays.asList(
          DescriptorDigest.fromDigest(
              "sha256:91e0cae00b86c289b33fee303a807ae72dd9f0315c16b74e6ab0cdbe9d996c10"),
          DescriptorDigest.fromHash(
              "4945ba5011739b0b98c4a41afe224e417f47c7c99b2ce76830999c9a0861b236"));

  TestJson.InnerObject innerObject1 = new TestJson.InnerObject();
  innerObject1.number = 42;
  innerObject1.texts = Collections.emptyList();
  TestJson.InnerObject innerObject2 = new TestJson.InnerObject();
  innerObject2.number = 99;
  innerObject2.texts = Collections.singletonList("some text");
  innerObject2.digests =
      Collections.singletonList(
          DescriptorDigest.fromDigest(
              "sha256:d38f571aa1c11e3d516e0ef7e513e7308ccbeb869770cb8c4319d63b10a0075e"));
  testJson.list = Arrays.asList(innerObject1, innerObject2);

  ByteArrayOutputStream jsonStream = new ByteArrayOutputStream();
  JsonTemplateMapper.writeJson(jsonStream, testJson);

  Assert.assertEquals(expectedJson, jsonStream.toString());
}
 
Example 10
Project: Hands-On-Android-UI-Development   File: AttachmentPreviewAdapter.java   View Source Code Vote up 5 votes
public void setAttachments(final List<Attachment> attachments) {
    this.attachments = attachments != null
            ? attachments
            : Collections.<Attachment>emptyList();

    notifyDataSetChanged();
}
 
Example 11
Project: googles-monorepo-demo   File: Ints.java   View Source Code Vote up 5 votes
@Override
public List<Integer> subList(int fromIndex, int toIndex) {
  int size = size();
  checkPositionIndexes(fromIndex, toIndex, size);
  if (fromIndex == toIndex) {
    return Collections.emptyList();
  }
  return new IntArrayAsList(array, start + fromIndex, start + toIndex);
}
 
Example 12
Project: jdk8u-jdk   File: RelationNotification.java   View Source Code Vote up 5 votes
/**
 * Returns new value of updated role (only for role update).
 *
 * @return the new value of the updated role.
 */
public List<ObjectName> getNewRoleValue() {
    List<ObjectName> result;
    if (newRoleValue != null) {
        result = new ArrayList<ObjectName>(newRoleValue);
    } else {
        result = Collections.emptyList();
    }
    return result;
}
 
Example 13
Project: hands-on-neo4j-devoxx-fr-2017   File: ResultRowDifference.java   View Source Code Vote up 4 votes
public ResultRowDifference() {
    this(Collections.emptyList(), Collections.emptyList());
}
 
Example 14
Project: elasticsearch_my   File: MapperTestUtils.java   View Source Code Vote up 4 votes
public static MapperService newMapperService(NamedXContentRegistry xContentRegistry, Path tempDir, Settings indexSettings)
        throws IOException {
    IndicesModule indicesModule = new IndicesModule(Collections.emptyList());
    return newMapperService(xContentRegistry, tempDir, indexSettings, indicesModule);
}
 
Example 15
Project: react-native-streaming-audio-player   File: RNAudioPlayerPackage.java   View Source Code Vote up 4 votes
@Override
public List<ViewManager> createViewManagers(
                          ReactApplicationContext reactContext) {
	return Collections.emptyList();
}
 
Example 16
Project: react-native-sound-player   File: RNSoundPlayerPackage.java   View Source Code Vote up 4 votes
@Override
public List<Class<? extends JavaScriptModule>> createJSModules() {
  return Collections.emptyList();
}
 
Example 17
Project: CustomWorldGen   File: CommandBanIp.java   View Source Code Vote up 4 votes
public List<String> getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos)
{
    return args.length == 1 ? getListOfStringsMatchingLastWord(args, server.getAllUsernames()) : Collections.<String>emptyList();
}
 
Example 18
Project: uavstack   File: TtlRunnable.java   View Source Code Vote up 3 votes
/**
 * wrapper input {@link Runnable} Collection to {@link TtlRunnable} Collection.
 *
 * @param tasks                            task to be wrapped. if input is {@code null}, return {@code null}.
 * @param releaseTtlValueReferenceAfterRun release TTL value reference after run, avoid memory leak even if {@link TtlRunnable} is referred.
 * @param idempotent                       is idempotent mode or not. if {@code true}, just return input {@link Runnable} when it's {@link TtlRunnable},
 *                                         otherwise throw {@link IllegalStateException}.
 *                                         <B><I>Caution</I></B>: {@code true} will cover up bugs! <b>DO NOT</b> set, only when you know why.
 * @return wrapped tasks
 * @throws IllegalStateException when input is {@link TtlRunnable} already and not idempotent.
 */
public static List<TtlRunnable> gets(Collection<? extends Runnable> tasks, boolean releaseTtlValueReferenceAfterRun, boolean idempotent) {
    if (null == tasks) {
        return Collections.emptyList();
    }
    List<TtlRunnable> copy = new ArrayList<TtlRunnable>();
    for (Runnable task : tasks) {
        copy.add(TtlRunnable.get(task, releaseTtlValueReferenceAfterRun, idempotent));
    }
    return copy;
}
 
Example 19
Project: elements-of-programming-interviews-solutions   File: GeneratePalindromicDecompositions.java   View Source Code Vote up 2 votes
public static List<List<String>> palindromicPartitioning(String input) {

        return Collections.emptyList();
    }
 
Example 20
Project: freecol   File: AIColony.java   View Source Code Vote up 2 votes
/**
 * Get the list of buildables in the colony plan.
 *
 * Public for the test suite.
 *
 * @return A list of planned {@code BuildableType}.
 */
public List<BuildableType> getPlannedBuildableTypes() {
    return (colonyPlan == null) ? Collections.<BuildableType>emptyList()
        : colonyPlan.getBuildableTypes();
}