Skip to content
This repository has been archived by the owner on Aug 20, 2021. It is now read-only.

Collections. emptyList() 变成 static import #26

Closed
venusdrogon opened this issue Jul 1, 2016 · 2 comments
Closed

Collections. emptyList() 变成 static import #26

venusdrogon opened this issue Jul 1, 2016 · 2 comments
Assignees
Milestone

Comments

@venusdrogon
Copy link
Collaborator

Collections. emptyList() 变成 static import

@venusdrogon venusdrogon added this to the 1.8.0 milestone Jul 1, 2016
@venusdrogon venusdrogon self-assigned this Jul 1, 2016
@venusdrogon
Copy link
Collaborator Author

可以看到 junit 也在这么使用

比如

org.junit.experimental.theories.internal.Assignments.generateAssignmentsFromTypeAlone(ParameterSignature)

    private List<PotentialAssignment> generateAssignmentsFromTypeAlone(ParameterSignature unassigned) {
        Class<?> paramType = unassigned.getType();

        if (paramType.isEnum()) {
            return new EnumSupplier(paramType).getValueSources(unassigned);  
        } else if (paramType.equals(Boolean.class) || paramType.equals(boolean.class)) {
            return new BooleanSupplier().getValueSources(unassigned);
        } else {
            return emptyList();
        }
    }

@venusdrogon
Copy link
Collaborator Author

venusdrogon commented Jul 3, 2016

很多方法, 需要使用泛型化方法 的特性

必须有类名在最前面引出method方法,否则编译器报错。

无法使用静态inport

比如

   public static <O, V> List<O> selectRejected(Collection<O> objectCollection,String propertyName,Collection<V> propertyValueList){
        return Validator.isNullOrEmpty(objectCollection) ? Collections.<O> emptyList()
                        : selectRejected(objectCollection, new CollectionContainsPredicate<O>(propertyName, propertyValueList));
    }

@venusdrogon venusdrogon modified the milestone: 1.8.0 Jul 3, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant