org.jf.util.CollectionUtils Java Examples

The following examples show how to use org.jf.util.CollectionUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BuilderClassPool.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
@Nullable @Override
public Collection<? extends BuilderEncodedValue> getStaticInitializers(@Nonnull BuilderClassDef classDef) {
    final SortedSet<BuilderField> sortedStaticFields = classDef.getStaticFields();

    final int lastIndex = CollectionUtils.lastIndexOf(sortedStaticFields, HAS_INITIALIZER);
    if (lastIndex > -1) {
        return new AbstractCollection<BuilderEncodedValue>() {
            @Nonnull @Override public Iterator<BuilderEncodedValue> iterator() {
                return FluentIterable.from(sortedStaticFields)
                        .limit(lastIndex+1)
                        .transform(GET_INITIAL_VALUE).iterator();
            }

            @Override public int size() {
                return lastIndex+1;
            }
        };
    }
    return null;
}
 
Example #2
Source File: ClassPool.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
@Nullable @Override public Collection<? extends EncodedValue> getStaticInitializers(
        @Nonnull PoolClassDef classDef) {
    final SortedSet<Field> sortedStaticFields = classDef.getStaticFields();

    final int lastIndex = CollectionUtils.lastIndexOf(sortedStaticFields, HAS_INITIALIZER);
    if (lastIndex > -1) {
        return new AbstractCollection<EncodedValue>() {
            @Nonnull @Override public Iterator<EncodedValue> iterator() {
                return FluentIterable.from(sortedStaticFields)
                        .limit(lastIndex+1)
                        .transform(GET_INITIAL_VALUE).iterator();
            }

            @Override public int size() {
                return lastIndex+1;
            }
        };
    }
    return null;
}
 
Example #3
Source File: ClassPool.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
@Nullable @Override public Collection<? extends EncodedValue> getStaticInitializers(
        @Nonnull PoolClassDef classDef) {
    final SortedSet<Field> sortedStaticFields = classDef.getStaticFields();

    final int lastIndex = CollectionUtils.lastIndexOf(sortedStaticFields, HAS_INITIALIZER);
    if (lastIndex > -1) {
        return new AbstractCollection<EncodedValue>() {
            @Nonnull @Override public Iterator<EncodedValue> iterator() {
                return FluentIterable.from(sortedStaticFields)
                        .limit(lastIndex+1)
                        .transform(GET_INITIAL_VALUE).iterator();
            }

            @Override public int size() {
                return lastIndex+1;
            }
        };
    }
    return null;
}
 
Example #4
Source File: BuilderClassPool.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
@Nullable @Override
public Collection<? extends BuilderEncodedValue> getStaticInitializers(@Nonnull BuilderClassDef classDef) {
    final SortedSet<BuilderField> sortedStaticFields = classDef.getStaticFields();

    final int lastIndex = CollectionUtils.lastIndexOf(sortedStaticFields, HAS_INITIALIZER);
    if (lastIndex > -1) {
        return new AbstractCollection<BuilderEncodedValue>() {
            @Nonnull @Override public Iterator<BuilderEncodedValue> iterator() {
                return FluentIterable.from(sortedStaticFields)
                        .limit(lastIndex+1)
                        .transform(GET_INITIAL_VALUE).iterator();
            }

            @Override public int size() {
                return lastIndex+1;
            }
        };
    }
    return null;
}
 
Example #5
Source File: BuilderClassPool.java    From HeyGirl with Apache License 2.0 6 votes vote down vote up
@Nullable @Override
public Collection<? extends BuilderEncodedValue> getStaticInitializers(@Nonnull BuilderClassDef classDef) {
    final SortedSet<BuilderField> sortedStaticFields = classDef.getStaticFields();

    final int lastIndex = CollectionUtils.lastIndexOf(sortedStaticFields, HAS_INITIALIZER);
    if (lastIndex > -1) {
        return new AbstractCollection<BuilderEncodedValue>() {
            @Nonnull @Override public Iterator<BuilderEncodedValue> iterator() {
                return FluentIterable.from(sortedStaticFields)
                        .limit(lastIndex+1)
                        .transform(GET_INITIAL_VALUE).iterator();
            }

            @Override public int size() {
                return lastIndex+1;
            }
        };
    }
    return null;
}
 
Example #6
Source File: ClassPool.java    From HeyGirl with Apache License 2.0 6 votes vote down vote up
@Nullable @Override public Collection<? extends EncodedValue> getStaticInitializers(
        @Nonnull PoolClassDef classDef) {
    final SortedSet<Field> sortedStaticFields = classDef.getStaticFields();

    final int lastIndex = CollectionUtils.lastIndexOf(sortedStaticFields, HAS_INITIALIZER);
    if (lastIndex > -1) {
        return new AbstractCollection<EncodedValue>() {
            @Nonnull @Override public Iterator<EncodedValue> iterator() {
                return FluentIterable.from(sortedStaticFields)
                        .limit(lastIndex+1)
                        .transform(GET_INITIAL_VALUE).iterator();
            }

            @Override public int size() {
                return lastIndex+1;
            }
        };
    }
    return null;
}
 
Example #7
Source File: BuilderClassPool.java    From zjdroid with Apache License 2.0 6 votes vote down vote up
@Nullable @Override
public Collection<? extends BuilderEncodedValue> getStaticInitializers(@Nonnull BuilderClassDef classDef) {
    final SortedSet<BuilderField> sortedStaticFields = classDef.getStaticFields();

    final int lastIndex = CollectionUtils.lastIndexOf(sortedStaticFields, HAS_INITIALIZER);
    if (lastIndex > -1) {
        return new AbstractCollection<BuilderEncodedValue>() {
            @Nonnull @Override public Iterator<BuilderEncodedValue> iterator() {
                return FluentIterable.from(sortedStaticFields)
                        .limit(lastIndex+1)
                        .transform(GET_INITIAL_VALUE).iterator();
            }

            @Override public int size() {
                return lastIndex+1;
            }
        };
    }
    return null;
}
 
Example #8
Source File: ClassPool.java    From zjdroid with Apache License 2.0 6 votes vote down vote up
@Nullable @Override public Collection<? extends EncodedValue> getStaticInitializers(
        @Nonnull PoolClassDef classDef) {
    final SortedSet<Field> sortedStaticFields = classDef.getStaticFields();

    final int lastIndex = CollectionUtils.lastIndexOf(sortedStaticFields, HAS_INITIALIZER);
    if (lastIndex > -1) {
        return new AbstractCollection<EncodedValue>() {
            @Nonnull @Override public Iterator<EncodedValue> iterator() {
                return FluentIterable.from(sortedStaticFields)
                        .limit(lastIndex+1)
                        .transform(GET_INITIAL_VALUE).iterator();
            }

            @Override public int size() {
                return lastIndex+1;
            }
        };
    }
    return null;
}
 
Example #9
Source File: BaseAnnotationEncodedValue.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public int compareTo(@Nonnull EncodedValue o) {
    int res = Ints.compare(getValueType(), o.getValueType());
    if (res != 0) return res;
    AnnotationEncodedValue other = (AnnotationEncodedValue)o;
    res = getType().compareTo(other.getType());
    if (res != 0) return res;
    return CollectionUtils.compareAsSet(getElements(), other.getElements());
}
 
Example #10
Source File: BaseMethodReference.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public int compareTo(@Nonnull MethodReference o) {
    int res = getDefiningClass().compareTo(o.getDefiningClass());
    if (res != 0) return res;
    res = getName().compareTo(o.getName());
    if (res != 0) return res;
    res = getReturnType().compareTo(o.getReturnType());
    if (res != 0) return res;
    return CollectionUtils.compareAsIterable(Ordering.usingToString(), getParameterTypes(), o.getParameterTypes());
}
 
Example #11
Source File: BaseAnnotationEncodedValue.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public int compareTo(@Nonnull EncodedValue o) {
    int res = Ints.compare(getValueType(), o.getValueType());
    if (res != 0) return res;
    AnnotationEncodedValue other = (AnnotationEncodedValue)o;
    res = getType().compareTo(other.getType());
    if (res != 0) return res;
    return CollectionUtils.compareAsSet(getElements(), other.getElements());
}
 
Example #12
Source File: BaseAnnotation.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public int compareTo(Annotation o) {
    int res = Ints.compare(getVisibility(), o.getVisibility());
    if (res != 0) return res;
    res = getType().compareTo(o.getType());
    if (res != 0) return res;
    return CollectionUtils.compareAsSet(getElements(), o.getElements());
}
 
Example #13
Source File: BaseMethodReference.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
@Override
public int compareTo(@Nonnull MethodReference o) {
    int res = getDefiningClass().compareTo(o.getDefiningClass());
    if (res != 0) return res;
    res = getName().compareTo(o.getName());
    if (res != 0) return res;
    res = getReturnType().compareTo(o.getReturnType());
    if (res != 0) return res;
    return CollectionUtils.compareAsIterable(Ordering.usingToString(), getParameterTypes(), o.getParameterTypes());
}
 
Example #14
Source File: BaseAnnotationEncodedValue.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
@Override
public int compareTo(@Nonnull EncodedValue o) {
    int res = Ints.compare(getValueType(), o.getValueType());
    if (res != 0) return res;
    AnnotationEncodedValue other = (AnnotationEncodedValue)o;
    res = getType().compareTo(other.getType());
    if (res != 0) return res;
    return CollectionUtils.compareAsSet(getElements(), other.getElements());
}
 
Example #15
Source File: BaseAnnotation.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
@Override
public int compareTo(Annotation o) {
    int res = Ints.compare(getVisibility(), o.getVisibility());
    if (res != 0) return res;
    res = getType().compareTo(o.getType());
    if (res != 0) return res;
    return CollectionUtils.compareAsSet(getElements(), o.getElements());
}
 
Example #16
Source File: BaseAnnotation.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public int compareTo(Annotation o) {
    int res = Ints.compare(getVisibility(), o.getVisibility());
    if (res != 0) return res;
    res = getType().compareTo(o.getType());
    if (res != 0) return res;
    return CollectionUtils.compareAsSet(getElements(), o.getElements());
}
 
Example #17
Source File: BaseMethodReference.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
@Override
public int compareTo(@Nonnull MethodReference o) {
    int res = getDefiningClass().compareTo(o.getDefiningClass());
    if (res != 0) return res;
    res = getName().compareTo(o.getName());
    if (res != 0) return res;
    res = getReturnType().compareTo(o.getReturnType());
    if (res != 0) return res;
    return CollectionUtils.compareAsIterable(Ordering.usingToString(), getParameterTypes(), o.getParameterTypes());
}
 
Example #18
Source File: BaseAnnotationEncodedValue.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
@Override
public int compareTo(@Nonnull EncodedValue o) {
    int res = Ints.compare(getValueType(), o.getValueType());
    if (res != 0) return res;
    AnnotationEncodedValue other = (AnnotationEncodedValue)o;
    res = getType().compareTo(other.getType());
    if (res != 0) return res;
    return CollectionUtils.compareAsSet(getElements(), other.getElements());
}
 
Example #19
Source File: BaseAnnotation.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
@Override
public int compareTo(Annotation o) {
    int res = Ints.compare(getVisibility(), o.getVisibility());
    if (res != 0) return res;
    res = getType().compareTo(o.getType());
    if (res != 0) return res;
    return CollectionUtils.compareAsSet(getElements(), o.getElements());
}
 
Example #20
Source File: BaseMethodReference.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
@Override
public int compareTo(@Nonnull MethodReference o) {
    int res = getDefiningClass().compareTo(o.getDefiningClass());
    if (res != 0) return res;
    res = getName().compareTo(o.getName());
    if (res != 0) return res;
    res = getReturnType().compareTo(o.getReturnType());
    if (res != 0) return res;
    return CollectionUtils.compareAsIterable(Ordering.usingToString(), getParameterTypes(), o.getParameterTypes());
}
 
Example #21
Source File: BuilderProtoReference.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
@Override
public int compareTo(@Nonnull BuilderProtoReference o) {
    int res = returnType.compareTo(o.returnType);
    if (res != 0) return res;
    return CollectionUtils.compareAsIterable(Ordering.usingToString(), parameterTypes, o.parameterTypes);
}
 
Example #22
Source File: BuilderProtoReference.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
@Override
public int compareTo(@Nonnull BuilderProtoReference o) {
    int res = returnType.compareTo(o.returnType);
    if (res != 0) return res;
    return CollectionUtils.compareAsIterable(Ordering.usingToString(), parameterTypes, o.parameterTypes);
}
 
Example #23
Source File: ProtoPool.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
@Override
public int compareTo(@Nonnull Key o) {
    int res = getReturnType().compareTo(o.getReturnType());
    if (res != 0) return res;
    return CollectionUtils.compareAsIterable(Ordering.usingToString(), getParameters(), o.getParameters());
}
 
Example #24
Source File: BaseArrayEncodedValue.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
@Override public int compareTo(@Nonnull EncodedValue o) {
    int res = Ints.compare(getValueType(), o.getValueType());
    if (res != 0) return res;
    return CollectionUtils.compareAsList(getValue(), ((ArrayEncodedValue)o).getValue());
}
 
Example #25
Source File: DexWriter.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
@Override public int hashCode() {
    return CollectionUtils.listHashCode(elements);
}
 
Example #26
Source File: BaseArrayEncodedValue.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
@Override public int compareTo(@Nonnull EncodedValue o) {
    int res = Ints.compare(getValueType(), o.getValueType());
    if (res != 0) return res;
    return CollectionUtils.compareAsList(getValue(), ((ArrayEncodedValue)o).getValue());
}
 
Example #27
Source File: DexWriter.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
@Override public int hashCode() {
    return CollectionUtils.listHashCode(elements);
}
 
Example #28
Source File: ProtoPool.java    From ZjDroid with Apache License 2.0 4 votes vote down vote up
@Override
public int compareTo(@Nonnull Key o) {
    int res = getReturnType().compareTo(o.getReturnType());
    if (res != 0) return res;
    return CollectionUtils.compareAsIterable(Ordering.usingToString(), getParameters(), o.getParameters());
}
 
Example #29
Source File: BuilderProtoReference.java    From HeyGirl with Apache License 2.0 4 votes vote down vote up
@Override
public int compareTo(@Nonnull BuilderProtoReference o) {
    int res = returnType.compareTo(o.returnType);
    if (res != 0) return res;
    return CollectionUtils.compareAsIterable(Ordering.usingToString(), parameterTypes, o.parameterTypes);
}
 
Example #30
Source File: ProtoPool.java    From zjdroid with Apache License 2.0 4 votes vote down vote up
@Override
public int compareTo(@Nonnull Key o) {
    int res = getReturnType().compareTo(o.getReturnType());
    if (res != 0) return res;
    return CollectionUtils.compareAsIterable(Ordering.usingToString(), getParameters(), o.getParameters());
}