The Artima Developer Community
Sponsored Link

Java Answers Forum
Collection

13 replies on 1 page. Most recent reply: Apr 9, 2003 3:19 AM by Adam Duffy

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 13 replies on 1 page
jake

Posts: 83
Nickname: onorok
Registered: May, 2002

Collection Posted: Apr 6, 2003 7:16 PM
Reply to this message Reply
Advertisement
The assignment is to implement the Collection interface using an array. So I am confused with this method,
addAll(Collection c)
Adds all of the elements in the specified collection to this collection (optional operation).

what is a collection? And how do I use it?
thanks.


Dhrubo

Posts: 32
Nickname: dhrubo
Registered: Mar, 2003

Re: Collection Posted: Apr 6, 2003 8:55 PM
Reply to this message Reply
Read any book on java to know about collection ,,,, this forum is not for teaching collections

Kishori Sharan

Posts: 211
Nickname: kishori
Registered: Feb, 2002

Re: Collection Posted: Apr 6, 2003 9:03 PM
Reply to this message Reply
That's right!!! This forum is not to teach Collection in Java. It is to teach something related to Python or Jython and but not Java!!!

jake

Posts: 83
Nickname: onorok
Registered: May, 2002

Re: Collection Posted: Apr 7, 2003 12:26 AM
Reply to this message Reply
Ok, well I guess I just miss read the title "Java Answers Forum", and the sub statement "A place where Java programmers can ask and answer questions.". Also why would you waste your time being a smart ass in the beginners forum? I mean I just posted to get a simple explanation, maybe the problem was was too hard for you guys and you were just intimidated by it. See I don't know you tell me. what?

Dhrubo

Posts: 32
Nickname: dhrubo
Registered: Mar, 2003

Re: Collection Posted: Apr 7, 2003 12:37 AM
Reply to this message Reply
Dear Jake ... this is a public forum and its better if ya mind yr language a bit ... for learning collections why don't ya refer so many free java books available online istead of posting qs here ..... www.maththinking.com is a good side where these free books are well - listed ... i hope ya will check yr tyos like "ass" ... else ya force us to come down to yr donkey levels....... and ya know well we can also use better words for ya

jake

Posts: 83
Nickname: onorok
Registered: May, 2002

Re: Collection Posted: Apr 7, 2003 1:25 AM
Reply to this message Reply
well thanks for the flipping gosh darnet advice there chief, if I wanted to look in a book to find this out I probably wouldn't have posted a freaking message on the forum. Anyways, why have a forum so you can give people advice like look in a book. I mean thats like a mechanic telling someone to go read a book on how to fix there car. But I guess I came to the wrong site ehh.

jake

Posts: 83
Nickname: onorok
Registered: May, 2002

Re: Collection Posted: Apr 7, 2003 1:28 AM
Reply to this message Reply
no no... thats TYPO...T..Y..P..O, typo.

Dhrubo

Posts: 32
Nickname: dhrubo
Registered: Mar, 2003

Re: Collection Posted: Apr 7, 2003 2:02 AM
Reply to this message Reply
well jake ... i m in office whole nite ... will provide ya solution to yr assignment after couple of hours ... hope that helps .. .and lets not fight with this

Senthoorkumaran Punniamoorthy

Posts: 335
Nickname: senthoor
Registered: Mar, 2002

Re: Collection Posted: Apr 8, 2003 10:10 AM
Reply to this message Reply
Why don't you do a search on google for this pharase.

"What is a java collection filetype:ppt"

you will get some Power Point Presentations where you can get some idea about collections

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: Collection Posted: Apr 8, 2003 11:44 AM
Reply to this message Reply
In Java, implementing Collection specifically means implementing the interface called Collection (java.util.Collection). You can look it up in the API documentation. Even better, if you have a smart editor (or IDE), it will automatically flesh out the implementation of any interface you implement. To "implement" an interface, you add "implements [interface mame]" after your class declaration, then add all the methods to your class which the interface contains.

Here's what it will look like:
class MyZanyCollection implements Collection
{
    public Collection()
    {
    }
 
    public boolean Add( object o )
    {
        // Add the one object to this collection.
    }
 
    public void AddAll( Collection c )
    {
        // Iterate over the Collection c and add each item
        // to this Collection.
    }
 
    ... all the rest of the methods in Collection ...
}

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: Collection Posted: Apr 8, 2003 11:45 AM
Reply to this message Reply
Make that "interface name"

jake

Posts: 83
Nickname: onorok
Registered: May, 2002

Re: Collection Posted: Apr 8, 2003 2:47 PM
Reply to this message Reply
thank you. I understand now.

Kishori Sharan

Posts: 211
Nickname: kishori
Registered: Feb, 2002

Re: Collection Posted: Apr 8, 2003 7:27 PM
Reply to this message Reply
What is this
"public Collection() { }" doing in your ZanyCollection?

Adam Duffy

Posts: 168
Nickname: adamduffy
Registered: Feb, 2003

Re: Collection Posted: Apr 9, 2003 3:19 AM
Reply to this message Reply
> What is this
> "public Collection() { }" doing in your
> ZanyCollection?

I suspect that it is just a typo. Perhaps the intended code was

public ZanyCollection() {
  // do something here
}


Adam

Flat View: This topic has 13 replies on 1 page
Topic: Pictures Previous Topic   Next Topic Topic: beginner's problem

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use