I know this has been asked a lot in stackoverflow but I could not find answers that work to my problem.
In the following code below, I cant print out each item in
You declare:
int from;
int to;
int type;
and you should declare them as Integers instead:
Integer from;
Integer to;
Integer type;
because later on you're doing:
this.from = new Integer(from);
etc.
A better option would be to change the assignment to:
this.from = from;
which would also solve this error since you would be assigning an int to an int. Is there a purpose you're using new Integer() ? because if not - I would suggest removing it - it's slower (performance-wise) comparing to the primitive int.
Bottom line: stay consistent and either use int throughout the code, or Integer - try not to mix them unless it's really required.