![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jan 2005
Posts: 21
Rep Power: 0
![]() |
Question about LinkedList [Solved]
Say S ={2,1,3} is a LinkedList. How could I change S.get(2) to int?
Last edited by quantalfred; Feb 19th, 2005 at 1:35 PM. |
|
|
|
|
|
#2 |
|
Hobbyist Programmer
|
int myInt = Integer.parseInt(S.get(2));
or somthing very, very similar to that. In any case, check out the Integer class. If you're using 1.5, Java automatically wraps ints into Integer, in order to store them on thie LinkedList (as the list stores its data as Object, which doesnt like primatives.) So, the LinkedList should return an Integer, which you unwrap with Integer.parseInt |
|
|
|
|
|
#3 | |
|
Newbie
Join Date: Jan 2005
Posts: 21
Rep Power: 0
![]() |
Quote:
|
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|