How about stealing/reusing the C# idiom of a "this" parameter:

public class MyList {
  public static void sort(this List<T>, Comparator<T> comparator) {
   ..
  }
}

Which compiles to the same as you suggest, being

new List().sort(comparator) being

MyList.sort(new List(), comparator);

This could also play well with introducing "this" as a return type for
chaining.

...and then Buffy staked Edward.  The End.


On Tue, Feb 24, 2009 at 4:33 PM, Reinier Zwitserloot <[email protected]>wrote:

>  @Extension public static <T> void sort(List<T> list, Comparator<T>
> comparator) { /* code */ }
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to