wood burning stoves 2.0*
The moose likes I/O and Streams and the fly likes Writing collection to a file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Writing collection to a file" Watch "Writing collection to a file" New topic
Author

Writing collection to a file

Jd Hanson
Greenhorn

Joined: Feb 18, 2012
Posts: 2

I get an error for something I think should work:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method get(Integer) is undefined for the type Collection<MyCal>

This is the offending line:
oos.writeObject(ccal.get(i));

Thanks for you help !




Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30929
    
158

get(int) is defined on List, not Collection. You can either pass in a List or change the implementation.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Writing collection to a file