Guava ImmutableCollection - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Guava ImmutableCollection class.

This code example shows how to use the following methods:toArray, size
    public Iterator<String> iterator() {
        return paths.iterator();
    } 
 
    public String[] toArray() {
        return paths.toArray(new String[paths.size()]);
    } 
 
    public BlobPath add(String path) {
        ImmutableList.Builder<String> builder = ImmutableList.builder();
        return new BlobPath(builder.addAll(paths).add(path).build());
    } 
 
    public String buildAsString(String separator) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < paths.size(); i++) {
            sb.append(paths.get(i));
            if (i < (paths.size() - 1)) {
                sb.append(separator);
            } 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:contains
        this.warnOnRmiStubs = warnOnRmiStubs;
    } 
 
    @Override 
    protected boolean excludeFromAntProperties(String fieldName) {
        return EXCLUDE_FROM_ANT_PROPERTIES.contains(fieldName);
    } 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:asList, isEmpty
    } 
 
    public String getMappedUsername(String dn)
    { 
        ImmutableCollection<String> names = _map.get(dn);
        return names.isEmpty() ? null : names.asList().get(0);
    } 
 
    public Collection<String> getMappedUsernames(String dn)
    { 
        return _map.get(dn);
    } 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:contains
        return this; 
    } 
 
    @Override 
    protected boolean excludeFromAntProperties(String fieldName) { 
        return EXCLUDE_FROM_ANT_PROPERTIES.contains(fieldName); 
    } 
 
    /** 
     * Internal method. 
     */ 
    public Map<String, Object> optionMap() { 
        Map<String, Object> map = super.optionMap(); 
        map.putAll(forkOptions.optionMap()); 
        if (optimizationOptions.containsKey("indy")) { 
            map.put("indy", optimizationOptions.get("indy")); 
        } 
        return map; 
    } 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:contains
        return map; 
    } 
 
    @Override 
    protected boolean excludeFromAntProperties(String fieldName) {
        return EXCLUDE_FROM_ANT_PROPERTIES.contains(fieldName);
    } 
 
    @Override 
    protected String getAntPropertyName(String fieldName) {
        if (fieldName.equals("warnings")) {
            return "nowarn"; 
        } 
        if (fieldName.equals("extensionDirs")) {
            return "extdirs"; 
        } 
        return fieldName;
    } 
 
    @Override 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:asList
This code example shows how to use the following methods:contains
This code example shows how to use the following methods:contains
    } 
 
    private static class DefaultStringMatchingStrategy implements StringMatchingStrategy { 
        @Override 
        public boolean containsMatch(ImmutableSet<String> matchExpressions, String metricName) {
            return matchExpressions.contains(metricName);
        } 
    } 
 
    private static class RegexStringMatchingStrategy implements StringMatchingStrategy { 
        private final LoadingCache<String, Pattern> patternCache;
 
        private RegexStringMatchingStrategy() { 
            patternCache = CacheBuilder.newBuilder()
                    .expireAfterWrite(1, TimeUnit.HOURS)
                    .build(new CacheLoader<String, Pattern>() {
                        @Override 
                        public Pattern load(String regex) throws Exception {
                            return Pattern.compile(regex);
                        } 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:asList
This code example shows how to use the following methods:asList, size
    } 
 
    public String optv(int i)
    { 
        ImmutableMultiset<String> keys = _options.keys();
        return (i < keys.size()) ? keys.asList().get(i) : null;
    } 
 
    public void shift() 
    { 
        if (!_arguments.isEmpty()) {
            _arguments = _arguments.subList(1, _arguments.size());
        } 
    } 
 
    public void shift(int n)
    { 
        while (n-- > 0) {
            shift(); 
        } 
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Guava ImmutableCollection Methods: