On Fri, Aug 22, 2008 at 9:28 PM, Matthew Toseland
<toad at amphibian.dyndns.org> wrote:
> On Thursday 14 August 2008 08:40, j16sdiz at freenetproject.org wrote:
>> Author: j16sdiz
>> Date: 2008-08-14 07:40:13 +0000 (Thu, 14 Aug 2008)
>> New Revision: 21832
>>
>> Modified:
>> trunk/freenet/src/freenet/config/Config.java
>> trunk/freenet/src/freenet/config/PersistentConfig.java
>> trunk/freenet/src/freenet/config/SubConfig.java
>> trunk/freenet/src/freenet/config/WrapperConfig.java
>> Log:
>> Generic
>>
>> Modified: trunk/freenet/src/freenet/config/SubConfig.java
>> ===================================================================
>> --- trunk/freenet/src/freenet/config/SubConfig.java 2008-08-14 07:39:51 UTC
> (rev 21831)
>> +++ trunk/freenet/src/freenet/config/SubConfig.java 2008-08-14 07:40:13 UTC
> (rev 21832)
>> @@ -304,15 +304,11 @@
>> return prefix;
>> }
>>
>> - public int compareTo(Object o){
>> - if((o == null) || !(o instanceof SubConfig)) return 0;
>> - else{
>> - SubConfig second = (SubConfig) o;
>> - if(this.getPrefix().compareTo(second.getPrefix())>0)
>> - return 1;
>> - else
>> - return -1;
>> - }
>> + public int compareTo(SubConfig second) {
>> + if (this.getPrefix().compareTo(second.getPrefix()) > 0)
>> + return 1;
>> + else
>> + return -1;
>> }
>
> Why doesn't this break Comparable ?
>
Comparable<T> gives declarle public int compareTo(T obj).
Java generic are just compile-time hints, the T is Object at bytecode level.
--