Generic unchecked problem

Hi All,
I have a problem with the following code . Can any one help me to over come the warning.
Here is my code:
import java.util.*;
public class CastEx {
public CastEx() {
     Vector<String> v1 = new Vector<String>(); // ok
     Object obj = (Object) v1; // ok
     Vector<String> v2 = (Vector<String>) obj ; //unchecked cast
public static void main(String[] args) {
     new CastEx();
Warning :
CastEx.java uses unchecked or unsafe operations.
Thanks in advance........

You have some choices:
1- Learn to live with the warning.
2- Use the annotation @SuppressWarning("unchecked") before the method or class.
3- Don't do this type of unchecked cast in your code.
4- Use another cast:Vector v2 = (Vector) obj;Regards

Similar Messages

  • Generic addAll problem

    I have the following problem with the generics (working in netbeans 3.3.1)
    The following nongeneric code works perfectly (of course):
    public class ABC {
        List mStrings;
        void addList(List a)    {mStrings.addAll(a);}
    }However, when I change it to generics:
    public class ABC {
        List<String> mStrings;
        void addList(List<String> a)   {mStrings.addAll(a);}
    }I get the following error
    ABC.java [20:15] cannot resolve symbol
    symbol : method addAll (java.util.List<java.lang.String>)
    location: interface java.util.List<java.lang.String>
    It is possible to fix the addList method in the following way (casting mStrings on List or Collection):
         void addList(List<String> a)   {((List)mStrings).addAll(a);}      Is'nt it strange? Or is there any more simple way to do it?
    Jiri Hana

    I could not reproduce this problem in the latest generics prototype.

  • Generic delta problem : in init load, the request is in yellow.......

    Hi all,
    I have created a table in R/3, and created a Generic data source using this table, and coming to deltas, i have selected Numeric pointer in which I have given the sales document number which comes from the table as the Delta relevant field. And the other things like replication, creation of info source, info package did well and I als got Initialization option in Info Package, but when I schedule the load, its coming in yellow signal and says that 0 records from 0 records, and gives error message as no records in the source system. This is the case if I use Init option in Info package.
    If I use Full load option in info pack, every thing is fine and I am able to extract the data from R/3 with out any problem, the load is getting succeeded.
    The only problem is with deltas. Is there anything else to do on R/3 side to enable the delta mechanism? or is it required to use functional module to enable the deltas ( I read this in some posts)? Please give me some solution.
    Thanks
    Ganesh

    Hi,
    There is no need to make any settings of delta...in general..it should work as similar as your full load....try to locate the problem area..and revert...
    Advise, check if there are any previous init. and delete...otherwise create a new
    infopackage and try..
    Cheers,
    Pattan.

  • Unchecked problem while compiling

    When compiling, I get a non-fatal warning, 'unchecked', what ever that means. It is the command flag Xlint-unchecked or something.
    The code is a static hashtable which I am statically putting elements into:
    public static Hashtable variables = new Hashtable();
    static{
      variables.put("###",...);
      //another 30 lines or so of the same...
    }1. What does unchecked mean?
    2. Why does the Hashtable give me this warning?
    3. How can it be fixed?
    Thanks

    This all has to do with the addition of generics to Java 5. Generics allow the specification of data types in the code so that errors (for instance, placing a String value in a hashtable intended to hold Integers) can be detected at compile time rather than run time.
    You are compiling some code that doesn't specify the data type.
    Add the following to the javac option to see the details of the warning. (See the javac documentation.)
    -Xlint:unchecked
    Give more detail for unchecked conversion warnings that are mandated by the Java Language Specification.
    Refer to this for what to do to fix it:
    http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html

  • Generic Comparator problem

    Hi!
    In our code we use Comparator, but can not make it work with generics.
    The only way is to insert cast in some places, but that destroy the point in using generics in the first place.
    Basically we have a superclass Foo and child classes FooA, FooB, FooC etc. (FooX extends Foo)
    In Foo there is a method that needs to compare two FooX objects (they are always both of the same type).
    So Foo declares an abstract method getComparator() and then calls compare() from it.
    The current code is like this :
    public abstract class Foo {
        public abstract Comparator<? extends Foo> getComparator();
        private int doAndCompare(Foo newFoo) {
            if (0 == this.getComparator().compare(this, newFoo)) {
             // some code ...
    // each FooX is like this
    public class FooA extends Foo {
        static Comparator<FooA> myComparator = new Comparator<FooA>() {
            public int compare(FooA one, FooA two) {
                // the computation is specific for each FooX
                return xxx; // compute and return some int value
        public Comparator<FooA> getComparator() {
            return  myComparator;
    }This code has a compile error in the if statement:
    The method compare(capture-of ? extends Foo, capture-of ? extends Foo) in the type Comparator<capture-of ? extends Foo> is not applicable for the arguments (Foo, Foo)
    I could use "super" instead of "extends" in the getComparator() definition, but the each FooX would have an error, which are solvable only by casting.
    Is there a cast-less solution ?

    This might not be the post that will answer your question (since I honestly do not completely get your question), but might provide some (to) creative insights.
    A weird construct that will work without casting (but probably not very useful):
    public static void main(String[] args) {
         FooX x1 = new FooX();
         FooX x2 = new FooX();
         // requires a parameter of type FooX
         x1.doAndCompare(x2);
         FooY y1 = new FooY();
         FooY y2 = new FooY();
         // requires a parameter of type FooY
         y1.doAndCompare(y2);
         Foo f1 = new FooY();
         Foo f2 = new FooY();
         f1.doAndCompare(y2); // requires a parameter of type Foo, so no actual benifit here? Will work though
         f1.doAndCompare(x2); // Will throw a ClassCastException, so not very usable
    static abstract class Foo<T extends Foo<?>> implements Comparable<T> {
         public void doAndCompare(T foo) {
              if (0 == this.compareTo(foo)) {
                   // do your magic
    static class FooX extends Foo<FooX> {
         public int compareTo(FooX o) {
              // TODO Auto-generated method stub
              return 0;
    static class FooY extends Foo<FooY> {
         public int compareTo(FooY o) {
              // TODO Auto-generated method stub
              return 0;
    }An example that works with casting and that will work:
    public static void main(String[] args) {
         FooX x1 = new FooX();
         FooX x2 = new FooX();
         // requires a parameter of type Foo, FooX.compareTo(FooX) will be invoked
         x1.doAndCompare(x2);
         FooY y1 = new FooY();
         FooY y2 = new FooY();
         // requires a parameter of type Foo, FooY.compareTo(FooY) will be invoked
         y1.doAndCompare(y2);
         // requires a parameter of type Foo
         y1.doAndCompare(x2); // will work
    static abstract class Foo implements Comparable<Foo> {
         public void doAndCompare(Foo foo) {
              if (0 == this.compareTo(foo)) {
                   // do your magic
    static class FooX extends Foo {
         public int compareTo(Foo foo) {
              if (foo instanceof FooX) {
                   return this.compareTo((FooX) foo);
              } else {
                   return 1; // return what's apropriate of not equal
         public int compareTo(FooX fooX) {
              return 0;
    static class FooY extends Foo {
         public int compareTo(Foo foo) {
              if (foo instanceof FooY) {
                   return this.compareTo((FooY) foo);
              } else {
                   return 1; // return what's apropriate of not equal
         public int compareTo(FooY fooY) {
              return 0;
    }I couldn't help noticing that in your original post you very specifically used 'if comparision == 0'. That looks a lot like Foo.equals() to me. Isn't that just what you want?

  • Generic Extraction Problem

    HI There,
    I am trying to creat grneric extractor (with Table) on MBEW table .while i saving it is not saving.it is showing some some error .
    *ERROR IS
    Diagnosis
    You tried to generate an extract structure with the template structure MBEW. This operation failed, because the template structure quantity fields or currency fields, for example, field LBKUM refer to a different table.
    Procedure
    Use the template structure to create a view or DDIC structure that does not contain the inadmissable fields.*
    As per my understanding we can't creat table type generic extractor ..we can creat a view on that table then only we creat gerneric extractor with view.
    Is my understanding correct..? or is there any onther assumption for the error.
    Plz assist me.
    Regards...KP

    H there..
    Thank you for the great responce...
    As in the error...In  MBEW table all the unit fields i,e  currency unit fields( WAERS) are coming from T001 table and quantity unit fields (MEINS) are coming from MARA table.
    i am thinking to creat a view with MBEW,MARA and T001 tables.i will seclect the char and key filelds from MBEW and related unit fields from MARA and T001.
    i guess this would be the solution..plz respond.
    Regards...KP

  • Generic delta problem

    Hi all,
    If suppose we don,t have delta facility in generic extraction on R/3 for Master Data. how can we maintain the delta for that one in BW.
    Thanks & Regards,
    Sri

    hi Sri,
    suppose we don't ...
    i think you can try flexible update for master data and via ods, create ods with same structure and key as the master data, create infosource for the ods, upload data to the ods.
    and set the master data as 'infoprovider', create update rules assign from the ods. so the 'delta' is handled by ods. hope this helps.

  • Function module based generic extractor - Problem with the selection

    Hi all
    The following is my code in the function module. I am able to get the entire data if i dont give any selections and the number of records is also correct. But when i select a MATNR value, it returns 0 records where as it needs to return 3 records. If i give selection based on bukrs, werks, lgort its working fine. But if i give selection based on MATNR, then it is not working.... I think there is a problem in the bold part of my code. If i debug, LS_MATNR is having the correct value which indicates that there is no problem with the value being passed to LS_MATNR from my selection screen of my datasource in RSA3. Even GT_WERKS is also having data. Please help.
    OPEN CURSOR WITH HOLD S_CURSOR FOR
    SELECT  MARA~MANDT
            MARA~MATNR
            MARC~WERKS
            MARD~LGORT
            MARA~MEINS
            MARD~LABST
            MARD~EINME
            MARD~SPEME
            MARD~RETME
            MARD~INSME
            MARD~UMLME
            MARD~VMLAB
            MARD~VMEIN
            MARD~VMSPE
            MARD~VMRET
            MARD~VMINS
            MARD~VMUML
            MARC~XCHPF
            MARD~KLABS
            MARD~KEINM
            MARD~KSPEM
            MARD~KINSM
    from MARA inner join MARC on
    MARAMANDT = MARCMANDT AND
    MARAMATNR = MARCMATNR
    inner join MARD on
    MARAMANDT = MARDMANDT AND
    MARAMATNR = MARDMATNR
    AND MARCWERKS = MARDWERKS
    for all entries in gt_werks
    where MARC~werks EQ gt_werks-werks
    AND MARA~MATNR in LS_MATNR.
        ENDIF.                             "First data package ?
    Fetch records into interface table.
      named E_T_'Name of extract structure'.
        FETCH NEXT CURSOR S_CURSOR
                   APPENDING CORRESPONDING FIELDS
                   OF TABLE E_T_DATA
                   PACKAGE SIZE S_S_IF-MAXSIZE.

    try this
    select marc~matnr MARC~WERKS into t_marc for all entries in gt_werks
    where werks EQ gt_werks-werks and lvorm = space.
    if t_marc is not initial.
    select MARD~LGORT MARD~WERKS MARA~MEINS MARD~LABST MARD~EINME
    MARD~SPEME MARD~RETME MARD~INSME MARD~UMLME
    MARD~VMLAB MARD~VMEIN MARD~VMSPE MARD~VMRET
    MARD~VMINS MARD~VMUML MARC~XCHPF MARD~KLABS
    MARD~KEINM MARD~KSPEM MARD~KINSM  MARA~MEINS  from
    mard inner join MARA on mard~matnr = mara~matnr
    for all entries in t_marc where  mard~matnr = t_marc-matnr and mard-werks = t_marc-matnr
    and mard~lvorm = space.

  • Generic delta problems

    hai guys,
    in generic delta having  3 options like numaric pointer ,
    time stamp and 0calday
    i have confusin when did select perticur option
    plz let me know
    waiting for reply
    murali

    Hi,
    In case we dont have a business content datasource and the standard table also dont contain any field to register the latest change in time/day/numeric pointer ( for example sd billing plan data ) for that we need to go building a data source following the standard lo queue delta mechanism. To provide dela to datasource the association to a target syetm is required to store the dela queue as well as to extraction also.
    Could you please through some infomation for doing the same.
    Many thanks to all the Great Gurus.
    Regards,
    Jugal

  • Report sel. screen checkbox unchecked problem

    Hello,
    I have writen a report and on its selection screen, the logic is if checkbox is checked, one parameter field should be made as "required".
    I did it at selection screen output and using screen-required field as '1'. It works.
    But if user un-checks the checkbox after checking it, still the parameter field stays as required. It does not become a optional field.
    What should I do to remove this required parameter?
    I tried at-selection-screen on field for both checkbox and parameter field. But it does not work.
    Pls advice.
    Thanks,
    Rupali.

    Sorry. But I did not get your answer.
    I am still on the selection-screen.
    1) When I check the checkbox, the field becoms required. I get the message to enter some value for that field, when I press F8. ( Which is correct.).
    2) I decide not to enter any value. But I uncheck the checkbox.
    3) Still the parameter field is required entry field. But I do not know what value to enter into that.
    So I am stuck at selection-screen.
    Thanks.

  • (Kodo 3.3.4) Generics & Xdoclet problem

    My development environment is java version "1.5.0_07" on XP Professional, with eclipse 3.2.
    I am using annotations via Xdoclet's @jdo to generate mapping metadata for my model objecs. This particular mapping that follows fails with a
    <pre>
    kodo.jdbc.meta.MappingInfoNotFoundException: No mapping information was
    found for "org.foobar.domain.Person.mCollectionOfStuff".
    </pre>
    The Xdoclet tags are as follows:
    <pre>
    * @jdo.field
    * collection-type="collection"
    * element-type="org.foobar.domain.IData"
    * embedded-element="false"
    * @jdo.field-vendor-extension vendor-name="kodo"
    * key="jdbc-field-map"
    * value="one-many"
    * @jdo.field-vendor-extension vendor-name="kodo"
    * key="jdbc-field-map/ref-column.ID"
    * value="DATAID"
    * @jdo.field-vendor-extension vendor-name="kodo"
    * key="jdbc-field-map/table"
    * value="PERSON_DATA"
    private List<IData> mCollectionOfStuff;
    </pre>
    When I remove the Generics friendly declaration to the following, it works:-
    <pre>
    private List mCollectionOfStuff;
    </pre>
    Does this mean that KODO 3.3.4 does not support Generics ?

    Laurent,
    I'm very sure my build environment is fine. I can compile, deploy & run without the use of generics for the Collection member. However, I will get a compile-time error when I declared the collection using generics.
    Thanks
    Gavin

  • A generic compilation problem......

    I have the following method code......
    public static <E extends Number> List<? super E> process(List<E> nums){    
         return null;
        }I am trying to invoke this in main() method using the following:
            List<Number> input = null;
            List<Number> output = null;
            output = process(input);   //line 3But in //line 3, i get the compilation error that
    found   : java.util.List<capture#183 of ? super java.lang.Number>
    required: java.util.List<java.lang.Number>
            output = process(input);
    1 errorI am getting the same error even when i use
           List<Integer> input = null;
            List<Number> output = null;
            output = process(input);I believe the above invocations are correct. What is the problem then??

    All right, i get it now.
    It's funny that i've taken this question from an SCJP preparation book, and the answer suggested by you is not there. Even their analysis is incorrect.
    So, the reason you had to change it from List<Number> to List<? super Number> is that the method return type is defined that way in method definition. More specifically, if '?' wildcard is used in method definition for the passed type, we have to pass the argument exactly the same way (with ? wildcard) in method call.
    Is my understanding correct?

  • Insert Generic Shuffle Problem Here

    Okay, first things first:
    512 1st gen Shuffle (1.1.2)
    still has two weeks of limited warranty if I need it
    Win XP Pro
    iTunes 6 or I can use 7.0.1 as well. Either one.
    Okay, the problem is the shuffle retains files, music, etc, no blinky problems or anything. However, as soon as it's on its own it won't function. It has power and all, but no music will play, no matter what. It's not paused, the file extensions/compression are all great and the files aren't corrupt.
    After a while of wandering around, I've decided to attempt to restore OR update, but neither of them I can do because I get the infamous "The Ipod software updater server cannot be reached..."
    Yes, I am online, yes, the lan settings are auto-detected; I've run many restarts. I've even downloaded an older version of the 'firmware,' 2006-01-10.
    With this I get an invalid Ipod Service version.
    I have no idea what to do!
    Thanks in advance...
    Shuffle 1.1.2   Windows XP Pro   512, iTunes 6 or 7!

    Answer:
    iTunes 7.0.1; no idea why the updater *****?
    however, to solve this problem:
    Remove the shuffle if you have it in.
    Uninstall all of the demonic itunes 7.0.1 stuff. Warning: back up whatever you want with your music, if it's in your documents, you should be okay to begin with (but maybe not cause the conversion time of the files! ack).
    Install iTunes 6 (google and thou shall findst). Find an older updater from this website (2006-10-01 will do).
    AFTER 6 is well placed, etc, install the updater.
    After all is well and done, run the updater (without the shuffle connected). It will ask to mount (insert and ipod).
    Do so. Now run restore (I did ask to back up, no?), and it will do so and bring it to version 1.1.3 (if not already).
    Now! Add songs and LIFE IS WELL!
    Hope that helps some people.
    This fixes my above problem, and should also resolve problems such as "Ipod Service Updater is invalid, or so forth."

  • Generic Class Problem

    Consider the following simple class
    public myClass<E,F> {
       \\ Constructor
       public myClass(Object oE, Object oF) {
          \\ constructor code
    }Does anyone know how to impose at compile time that Object oE implements an Iterator iterface over a colection of type E and Object oF implements an Iterator iterface over a colection of type F?
    If not what is the best way of doing this at run time?

    I am not sure I understand. If I only have the
    Iterator interface passed into the constructor, how
    would I access some of the other methods on the
    object? I would not know which class to cast it back
    to.If you need to access other methods, then obviously "has to implement Iterator<E>" is by far not the only constraint the object has to fulfill, hence your interface is underspecified.
    You said "all you care about is that it's an Iterator<E>". I gave you that. If you need something else, you should say that.

  • Gnerics problem with Comparator

    i have to creat a program which deals with LinkedList...but I'll creat my own list which its name is "InOrderLinkedList"
    it's function is to take numbers and put them in the right order node
    i made 2 codes but one of them has an error (which i think it's about Generic Comparator Problem)
    and the other code doesn't have any error...but doesn't do any thing when i run it
    first code is:_
    import java.util.Collections;
    import java.util.List;
    import java.util.*;
    import java.util.Iterator;
    import java.util.ListIterator;
    import java.lang.Integer;
    import java.lang.Object;
    import java.lang.*;
    import javax.swing.*;
    class Node<E>{
              E item_;
              Node nextNode_=null;
              public void setItem(E item){
                   item_=(E)item;
              public Node<E> getNextNode(){
                   return nextNode_;
              public void setNextNode(Node nextNode){
                   this.nextNode_=nextNode;
              public String toString(){
                   return item_.toString();
              E getItem(){
                   return (E)item_;
    /*interface Comparator<E>{
         public int compareTo(E e1,E e2);
    class Comp implements Comparator <Integer>{
         public int compare(Integer e1,Integer e2){
         return e1-e2;
    class LinkedListme<E>{
         Node<Integer> head;
         Node<Integer> tail;
         int size=0;
         public void addFirst(int e){
              /*Node<E> node= new Node<E> (e);
              node.setNextNode(head);
              head=node;
              size++;*/
         public void addLast(int e){
              /*Node<E> node=new Node<E> (e);
              if(head==null){
                   head=node;
                   size++;
                   return;*
              Node<E> lastNode=head;
              while(lastNode.getNextNode()!=null){
                   lastNode=lastNode.getNextNode();
              lastNode.setNextNode(node);*/
         public void clear(){
              head=null;
              size=0;
         public int removeFirst(){
              Node<Integer> firstNode=head;
              head= head.getNextNode();
              size--;
              return firstNode.getItem();
         public int removeLast(){
              if (size==1)
                   return removeFirst();
              if (size==0)
                   return 0;
              Node<Integer> secondLast=head;
              Node<Integer> lastNode=null;
              while(secondLast.getNextNode().getNextNode()!=null){
                   secondLast=secondLast.getNextNode();
              lastNode=secondLast.getNextNode();
              secondLast.setNextNode(null);
              size--;
              return lastNode.getItem();
         public int remove(int index){
              Node<Integer> beforeRemoved=head;
              Node<Integer> removed=null;
              for(int i=1;i<(index-1);i++){
                   beforeRemoved=beforeRemoved.getNextNode();
              removed=beforeRemoved.getNextNode();
              beforeRemoved.setNextNode(removed.getNextNode());
              return removed.getItem();
         public void add(int index,int x){
              /*Node<E> beforeAdd=head;
              Node<E> newNode=new Node<E> (x);
              for(int i=1;i<(index-1);i++){
                   beforeAdd=beforeAdd.getNextNode();
              newNode.setNextNode(beforeAdd.getNextNode());
              beforeAdd.setNextNode(newNode);*/
         /*public void prnt(LinkedListme<E> l){
              System.out.print(l);
    public class InOrderLinkedList <E> extends LinkedListme<E>{
         public void add (int elem){
              Node <Integer> newNode = new Node <Integer>();
              newNode.setItem(elem);
              if(head==null){
                   head=newNode;
                   tail=newNode;
                   newNode.setNextNode(head);
                   head=newNode;
    //public class LinkedListme {
    public static void main(String[]args){
         InOrderLinkedList <Integer> list=new InOrderLinkedList <Integer>();
         Comp com=new Comp();
         list.add(5);
         list.add(5);
         list.add(3);
         list.add(6);
         list.add(3);
         list.add(2);
         list.add(1);
         Collections.sort(list,com); ///here is the error
         System.out.println(list.toString());
    the second code is:_
    import java.util.*;
    import java.util.Iterator;
    import java.util.ListIterator;
    import java.lang.Integer;
    import java.lang.*;
    import javax.swing.*;
    class Node<E>{
              E item_;
              Node <E>nextNode_=null;
              public void setItem(E item){
                   item_=(E)item;
              public Node<E> getNextNode(){
                   return nextNode_;
              public void setNextNode(Node <E>nextNode){
                   this.nextNode_=nextNode;
              public String toString(){
                   return item_.toString();
              E getItem(){
                   return (E)item_;
    /*interface Comparator<E>{
         public int compareTo(E e1,E e2);
    class Comp implements Comparator <Integer>{
         public int compare(Integer e1,Integer e2){
         return e1-e2;
    class LinkedListme<E>{
         Node<Integer> head;
         Node<Integer> tail;
         int size=0;
         public void addFirst(int e){
              /*Node<E> node= new Node<E> (e);
              node.setNextNode(head);
              head=node;
              size++;*/
         public void addLast(int e){
              /*Node<E> node=new Node<E> (e);
              if(head==null){
                   head=node;
                   size++;
                   return;*
              Node<E> lastNode=head;
              while(lastNode.getNextNode()!=null){
                   lastNode=lastNode.getNextNode();
              lastNode.setNextNode(node);*/
         public void clear(){
              head=null;
              size=0;
         public int removeFirst(){
              Node<Integer> firstNode=head;
              head= head.getNextNode();
              size--;
              return firstNode.getItem();
         public int removeLast(){
              if (size==1)
                   return removeFirst();
              if (size==0)
                   return 0;
              Node<Integer> secondLast=head;
              Node<Integer> lastNode=null;
              while(secondLast.getNextNode().getNextNode()!=null){
                   secondLast=secondLast.getNextNode();
              lastNode=secondLast.getNextNode();
              secondLast.setNextNode(null);
              size--;
              return lastNode.getItem();
         public int remove(int index){
              Node<Integer> beforeRemoved=head;
              Node<Integer> removed=null;
              for(int i=1;i<(index-1);i++){
                   beforeRemoved=beforeRemoved.getNextNode();
              removed=beforeRemoved.getNextNode();
              beforeRemoved.setNextNode(removed.getNextNode());
              return removed.getItem();
         public void add(int index,int x){
              /*Node<E> beforeAdd=head;
              Node<E> newNode=new Node<E> (x);
              for(int i=1;i<(index-1);i++){
                   beforeAdd=beforeAdd.getNextNode();
              newNode.setNextNode(beforeAdd.getNextNode());
              beforeAdd.setNextNode(newNode);*/
         /*public void prnt(LinkedListme<E> l){
              System.out.print(l);
    public class InOrderLinkedList <E> extends LinkedListme<E>{
         Comp com=new Comp();
         public void add (int elem){
              Node <Integer> newNode = new Node <Integer>();
              newNode.setItem(elem);
              if(head==null){
                   head=newNode;
                   tail=newNode;
              if(com.compare(head.getItem(), elem)>=0){
                   newNode.setNextNode(head);
                   head=newNode;
                   return;
                   Node<Integer> lastNode=head;
                   //Integer lastNodeInt=(Integer)lastNode;
              int compVal=com.compare(lastNode.getItem(), elem);
              while(compVal<0 && lastNode.getNextNode()!=null){
                   lastNode=lastNode.getNextNode();
              if(lastNode.getNextNode()==null){
                   lastNode.setNextNode(newNode);
              tail=newNode;     
              else{
                   newNode.setNextNode(lastNode.getNextNode());
                   lastNode.setNextNode(newNode);
    //public class LinkedListme {
    public static void main(String[]args){
         InOrderLinkedList <Integer> list=new InOrderLinkedList <Integer>();
         list.add(5);
         list.add(9);
         list.add(3);
         list.add(6);
         list.add(3);
         list.add(2);
         list.add(1);
         System.out.println(list.toString());
    what are thier problems??
    thanks

    So what's the error message?

Maybe you are looking for

  • What type of partition should I use? Range or Hash or ..?

    Hi, I am on Oracle 8.1.7.4 . I have a table with 10 million rows and looks like its a good candidate for partitioning. There is a varchar2 column and the data is evenly distributed on the string value. If I want to partition the table on that string

  • Is there anyway to see/sort/seperate the  photos that I have not organized into albums?

    I have recently combined many Iphoto libraries into one and I am trying to organize my photos.  I started making albums after I imported and would would like to continue.... but I cant tell where I left off... and the giant import has now been turned

  • 3 Displays & Cinema Desktop Preview

    Hi all... Have been all over the fora and found many similar problems but none that exactly duplicate my problem. I have an Apple 23" Display and a Small PAL monitor running off my Radeon 2600 via Apples DVI to Video converter connector. I use the TV

  • LR5 on desktop but LR4 on laptop?

    Hi I've just switched from Aftershot to LR5 which works great on Mac desktop running 10.8.5. I'm still running 10.6.8 on the laptop because once in a while use legacy s/w which needs Rosetta. Since LR5 wont run on 10.6.8 I tried dowloading LR4 but it

  • Sharing context across views

    Hi. Each of the individual views (10+) in my WebDynpro application needs to know and display the same employee information about the logged-in user. Further, the user can enter the application from any one of the views. And once the application is en