Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Help the idiot plox!

Name: poolboy 2006-11-16 20:41

Hey. I could use some help hear. i cant get my code to work. yes i know this is stupid as sin but its for a class. I have to place 3 names in order alphabeticly. how the names get in is unimportant, but what i need is the code to sort the names. you all would be tits ass kewl if you could tell me the right lines for this cuz i am tired of failling. lol.

Name: Anonymous 2006-11-18 12:13

>>18

It sorts just fine, although it (of course) takes abit more syntax than <insert your favorite scripting language>.

      List list = new ArrayList();
 
      list.add("abc");
      list.add("DEF");
      list.add("ghi");
 
      // standard sort
 
      Collections.sort(list);

I agree that equals and compareTo methods are ugly. I also don't like primitives in Java. It's still an OK language, though I prefer a (READ: my favorite) scripting language over it.

== is used to checking if two variables refrence the same object instance, hence it can't be used to compare the content of the object. I'd like it to though.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List