Maybe I'm missing something obvious, but why does this code:
public class FirstCodenameOneLibrary {
/**
* Method javadoc information
*/
public void hello() {
System.out.println("Hello");
}
public void addObjects(Map<Integer, Object> objects) {
int maxObjNumber = Collections.max(objects.keySet());
}
}
give this error:
Compiling 1 source file to /home/bryanb/NetBeansProjects/PDFjet/build/tmp
/home/bryanb/NetBeansProjects/PDFjet/src/com/codename1/hello/FirstCodenameOneLibrary.java:24:
error: no suitable method found for max(Set<Integer>)
int maxObjNumber = Collections.max(objects.keySet());
method Collections.<T#1>max(Collection<? extends T#1>) is not applicable
(inferred type does not conform to upper bound(s)
inferred: Integer
upper bound(s): Comparable<? super Integer>,Object)
method Collections.<T#2>max(Collection<? extends T#2>,Comparator<?
super T#2>) is not applicable
(cannot infer type-variable(s) T#2
(actual and formal argument lists differ in length))
where T#1,T#2 are type-variables:
T#1 extends Object,Comparable<? super T#1> declared in method
<T#1>max(Collection<? extends T#1>)
T#2 extends Object declared in method <T#2>max(Collection<? extends
T#2>,Comparator<? super T#2>)
1 error
The Netbeans project is JDK8. The same code compiles fine with JavaSE. The
method signatures for Collections.max() are the same for CN1 and regular
Java.
--
You received this message because you are subscribed to the Google Groups
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit
https://groups.google.com/d/msgid/codenameone-discussions/17ba622f-463d-4aa7-a61f-a09aa0b0ef35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.