Public feed
#722724
(02:13:47 AM) iamgedanken: sorry for the noob question, but what is the difference between an arraylist and a collection?
(02:14:13 AM) ojacobson: An ArrayList is one kind of Collection; there are others
(02:14:29 AM) Logi: ArrayList implements List extends Collection
(02:14:34 AM) iamgedanken: o rly
(02:14:42 AM) iamgedanken: ok that makes sense
(02:14:47 AM) ojacobson: ~javadoc Collection
(02:14:47 AM) javabot: ojacobson, please see java.util.Collection: http://java.sun.com/javase/6/docs/api/java/util/Collection.html
(02:14:49 AM) iamgedanken: thanks very much
(02:14:56 AM) Logi: HashMap implements Map which is a collection even if it doesn't implement Collection directly
(02:15:05 AM) kimtiede: An ArrayList gives easy random access to the elements
(02:15:12 AM) codeshepherd: Collection = List Or Set ; List = ArrayList or LinkedList .. iamgedanken
(02:15:21 AM) Logi: Map m=...; m.keySet() instanceof Set implements Colletion
(02:15:32 AM) cybereal_design_patterns_utah: Logi: to be fair, it's a relationship of collections as provided
(02:15:38 AM) cybereal_design_patterns_utah: entrySet, keySet, values
(02:15:43 AM) codeshepherd: List and Set are interfaces implementing Collection... ArrayList is a Class implementing interface List.. iamgedanken
(02:16:16 AM) iamgedanken: alright I understand now thanks for your time
(02:16:20 AM) iamgedanken: :)
loesh Logi
(02:16:32 AM) codeshepherd: Logi: HashMap is not a Collection..
(02:16:39 AM) Logi: iamgedanken: you'll excuse us if we now spend the next half hour arguing about terminology?
(02:16:44 AM) Budda|: ojacobson: Any idea why http://pastebin.ca/722718 doesn't work?
(02:16:45 AM) codeshepherd: HashMap does not implement the Collection interface ..
(02:16:48 AM) Logi: codeshepherd: it is with a lower case "c"
loesh Logi
(02:17:24 AM) aditsu: in STL style it would be a collection of pairs :)
(02:17:25 AM) iamgedanken: Logi yeah go for it haha
(02:17:27 AM) ojacobson: Nope. Print out the Socket object (and possibly its identityhashcode) compared to the ones in the users array.
(02:17:33 AM) codeshepherd: Logi: sorry I dont unerstand.. what is the difference ?
(02:17:51 AM) ojacobson: codeshepherd: A map is a collection of pairs, but it's not a Collection
(02:17:58 AM) sleepster left the room (quit: "See ya on the bit side").
(02:18:01 AM) ojacobson: eg it doesn't implement the Collection interface
(02:18:03 AM) Logi: codeshepherd: Collection is an interface and Map doesn't extend it. but what ojacobson said
(02:18:21 AM) codeshepherd: oh ok.. Yes, in English.. not in Java :P
(02:18:24 AM) ytojack left the room (quit: "Leaving.").
(02:18:26 AM) ojacobson: Right :)