TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jay S
NA
230
59.4k
C# List<T> in Java
Sep 8 2014 9:17 AM
Java noob here, coming from a C# background and having a couple of issues trying to re-write something in Java.
In C# I'd have something like this:
Main class:
System.IO.FileStream cityInput = System.IO.File.Open(this.path, System.IO.FileMode.Open);
System.IO.BinaryReader cityBr = new System.IO.BinaryReader(cityInput);
long CityList = 10;
this.Cities = new System.Collections.Generic.List<Cities>();
int c = 0;
while (c < CityList)
{
Cities item = new Cities(cityBr);
this.Cities.Add(item);
c++;
}
cityBr.Close();
And then my Cities Class:
namespace myObjects
{
public class Cities
{
public byte cityAttraction;
public short cityID;
public Cities()
{
}
public Cities(System.IO.BinaryReader reader)
{
this.cityAttraction = reader.ReadByte();
this.cityID = reader.ReadInt16();
}
}
}
I have been able to write my own binaryreader class in java based on some code i found in github.
My issue that I cannot work out is how to create a generic list collection based on a class in java.
Any help/direction/example would be great.
Reply
Answers (
1
)
mca fresher
Adding multiple digital signatures to text.