Skip to content

Instantly share code, notes, and snippets.

@peas
Created January 5, 2014 12:57

Revisions

  1. peas created this gist Jan 5, 2014.
    16 changes: 16 additions & 0 deletions javaerror.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    javac br/com/casadocodigo/java8/Capitulo5.java
    br/com/casadocodigo/java8/Capitulo5.java:44: error: variable comparator is already defined in method main(String[])
    Comparator<Usuario> comparator =
    ^
    br/com/casadocodigo/java8/Capitulo5.java:58: error: cannot find symbol
    .thenComparing(s -> s.length());
    ^
    symbol: method length()
    location: variable s of type Object
    br/com/casadocodigo/java8/Capitulo5.java:58: error: incompatible types: no instance(s) of type variable(s) U exist so that Comparator<Object> conforms to Comparator<String>
    .thenComparing(s -> s.length());
    ^
    where U,T are type-variables:
    U extends Comparable<? super U> declared in method <U>thenComparing(Function<? super T,? extends U>)
    T extends Object declared in interface Comparator
    3 errors