JNA: Structure by pointer in a linked list

Hello, I've been trying to figure this out but so far no luck. Here's what I have in C:
typedef struct _strvectitem
     char *szValue;
     void *pData;
     struct _strvectitem *pNext;
} STRVECTITEM, *PSTRVECTITEM;
typedef struct _strvect
     unsigned long nNumItems;
     PSTRVECTITEM pFirst;
     PSTRVECTITEM pLast;
} STRVECT, *PSTRVECT;
which I have translated to Java following the JNA API
     public static class PStrVectItem extends Structure {
          public static class ByReference extends PStrVectItem implements Structure.ByReference {}
          public String szValue;
          public Pointer pData;
          public PStrVectItem.ByReference pNext;
     public static class PNameVect extends Structure {
          public static class ByReference extends PNameVect implements Structure.ByReference {}
          public NativeLong nNumItems;
          public PStrVectItem.ByReference pFirst;
          public PStrVectItem.ByReference pLast;
This works well if I call a function:
//--- C ---
int PassStructurePtr( PNAMEVECT pItem );
translated in Java to
//--- Java ---
int PassStructurePtr(PNameVect pItem);
PNameVect pItem = PNameVect();
PassStructurePtr(pItem);
BUT I can't figure out what to pass to a function that has the following signature:
//--- C ---
int PassStructurePtrPtr( PNAMEVECT *ppItem );
I have tried passing the PNameVect by reference like this:
//--- Java ---
int PassStructurePtrPtr(PNameVect ppItem);
PNameVect.ByReference ppItem = PNameVect.ByReference();
PassStructurePtrPtr(ppItem);
but this does not seem to work.
What am I doing wrong? Thanks for the help!
Slawek

Use code tags when you post code.
Also note that this is a JNI forum not a JNA forum. So whether you get any help here depends solely on whether someone who knows JNA in detail wanders by.

Similar Messages

  • Help on Linked List

    Hey people, i need a small help on my linked list.
    Ok, what i'm trying to do is have a search function with a linked list using strings. First i will have a string, i will then compute the ASCII value for that and take MOD 71 lets say. For example, a string has an ASCII value of 216, MOD 71 of this gives me 3. I will then have an array of 71, and each array will point to a linked list. There will be as many linked list as there are of arrays (71). I will then store this string at index [3] in the linked list in which the array points to.
    My problem for now is, how do i for example create 71 linked list? So far i can create only 1. To create another is easy, but if i have 71 the code will be too much. Is there an iterator i could use that easily creates 71? Sorry about this, i'm not really good with linked list with Java. Anyway, here is what i have now :).
    public class MyLinkedListElement {   
            String string;
            MyLinkedListElement next;
            public MyLinkedListElement(String s) {   
                string = s;
                next = null;   
            public MyLinkedListElement getNext() {
                return next;       
            public String getValue() {
                return string;
    public class MyLinkedList {
        public static MyLinkedListElement head;
        public MyLinkedList() {   
            head = null;
       public static void addToHead(String s) {
            MyLinkedListElement a = new MyLinkedListElement(s);
            if (head == null) {
                head = a;
            } else {
                a.next = head;
                head = a;       
        public static void main(String[] args) {
              String[] arr = {"Bubble", "Angie", "Bob", "Bubble", "Adam"};
              for (int i = 0; i < arr.length; i++) {
                          addToHead(arr);
    MyLinkedListElement current = head;
    while (current != null) {
    System.out.println(current.getValue());
    current = current.next;
    }I can have an array of strings and easily add them to a linked list.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    I am very confused now, i just need to store a string value inside an array of linked list. But i can't somehow do it. I am very close, i can store the value in a linked list but the array of linked list, this is what i have.
    public class MyLinkedListElement {   
            String string;
            MyLinkedListElement next;
            public MyLinkedListElement(String s) {   
                string = s;
                next = null;   
            public MyLinkedListElement getNext() {
                return next;       
            public String getValue() {
                return string;
    public class MyLinkedList {
        public MyLinkedListElement head;
        public MyLinkedList() {   
              head = null;
        public void addToHead(String s) {
             MyLinkedListElement  a = new MyLinkedListElement(s);
             MyLinkedList[] arrayOfLinkedLists = new MyLinkedList[71];
             for(int i = 0; i < arrayOfLinkedLists.length; i++) {
                 arrayOfLinkedLists[i] = new MyLinkedList();
             if (head == null) {    
                 head = a;
             } else {
                 a.next = head;
                 head = a;       
        public void print(MyLinkedListElement current) {
              while (current  != null) {
                    System.out.println(current.getValue());
                    current = current.next;
        public static void main(String[] args) {
              String[] arr = {"Bubble", "Angie", "Bob", "Bubble", "Adam"};
              MyLinkedList listInstance = new MyLinkedList();
              for (int i = 0; i < arr.length; i++) {
                    listInstance.addToHead(arr);
    MyLinkedListElement current = listInstance.head;
    listInstance.print(current);

  • Linked List, Stacks and Other Data Structures in Objective-C 2.0

    I've checked a little throughout documentation that Apple provides for the different frameworks in order to determine if there were ready-made classes for data structures such as linked lists, stacks and so forth but there don't appear to be any available? Is this correct?

    NSArray and NSDictionary are the multi-purpose built-in aggregate types. If you need something else then you can use STL or roll your own.

  • Incementing 'pointer' in linked list

    Hi,
    Im trying to create a linked list in java having just been coding in C so im all mixed up. i have created a simple linked list and now hope to use inheritance to develope this list into something more practical and adding insert, removes and existence checks. i am using a system whereby i have defined a link within the list which i am also using as a 'pointer' so i can do things like the functions mentioned above.
    i thought that in order to increment my pointer onto the next link in the list i would type node.next (where node is the name of the link). this is not working at all and i havent a clue how to fix it.
    here is the code i am using:
    public class link
        public int value;
        public link next;
        public link(int data, link nxt)
            value = data;
            next = nxt;
    public class LinkedList {
        public link head;
        public link tail;
        public int length;
        public LinkedList()
            create();
        public void create()
            this.length = 0;
            this.head = null;
            this.tail = null;
        public void cons(int data)
            if(head == null)
                head = new link(data, head);
                tail = head;
                length++;
            } else {
                head = new link(data, head);
                length++;
        public int head()
            return head.value;
        public int tail()
            return tail.value;
        public boolean isEmpty()
            if(head == null)
                return true;
            } else {
                return false;
    public class Ordered extends LinkedList {
        public link node;
        public void insert(int data, int pos)
               //insert code to go here
        public int remove(int pos)
            int counter = 0;
            int data = null;
            node = head;
            if(pos < length){
                while(counter < pos){
                    node.next;  //increment node here
                    counter++;
                data = node.value;
            return data;
        public boolean isIn(int data)
            int counter = 0;
            boolean flag = false;
            node = tail;
            while(counter < length){
               if(node.value == data){
                    flag = true;
               counter++;
               //increment node here
            return flag;
    }Many thanks in advance,
    Nick

    Hey,
    i have an update on this problem. i used the node = node.next suggestion but that will not actually allow me to edit the object at all, it just copies it.
    is there anyway of iterating through the links (objects) in order to edit their variables? im trying to implement the remove code now but if i want to change the next value on the selected link it will only change it in the copy that is being stored under node, not that actual object.
    heres the code:
        public int remove(int pos)
            int counter = 1;
            int data = 0;
            node = head;
            if(pos <= length){
                while(counter < (length - pos)){ //this loop will set node to the link that needs to be
                    node = node.next;                     //removed from the linked list
                    counter++;
                counter = 0;
                node2 = head;
                while(counter < (pos - 1)){ //this loop sets node2 to the link before the link that
                    node2 = node2.next;       //needs to be removed
                    counter++;
                data = node.value; //stores the value of the link to be removed
                node = node.next; //increments node to the next link
                node2.next = node; //the next value at node2 is then changed so that it bypasses
                length--;                     //the link i want removed
            return data;
        }i have annotated my intentions of each line, but they do not actually do what i want.
    if anyone knows how to change the variables in a object could you help me out please,
    cheers, Nick

  • Create a linked list

    Hi guys!
    I read the manual of java 2 and says that is not that pointers don't exist, they do exist but they are not explicit as they are in C languagge. So in need to create a circular linked list how can I do this? The instructions of the manual are not so clear. Does anyone have an idea and can give me a sample code?
    Thanks to all
    Maddy

    References are like pointers except that you cannot make any add operation on them. But you can of course change their values to make it point to other objects.
    This also means that you can create graph objects and every data structure you like. For example :
    class BinaryNode {
        public Object data;
        public BinaryNode left;
        public BinaryNode right;
    }To create binary trees or
    class GraphNode {
        public Object data;
        public ArrayList links;
    }Where links is a Java list containing a list of links (references) to other GraphNode.
    Matthieu

  • Is it possible to implement or represent a Linked List in LabVIEW?

    Linked lists are a useful way to store and retrieve data and I am wondering if it is possible to create or acheive the same objective of a linked list in LabVIEW.

    A linked list is a collection of nodes, each node has data and a link (or pointer) to the location of the next node.
    In LabVIEW we can create a collection of nodes as an array of clusters. One element of the cluster will be our data, and the other will be an integer pointer to the location in the array, of our next node.
    In, fact you can go crazy and represent a LabVIEW Hierarchy in a similar fasion (a tree structure). Now, each cluster will have data about the VI (its Name, attributes, etc), an array of integers that point the the locations of calling VIs, and an array of integers that point the the locations of subVIs.
    You will, of course also need some tools for sorting your lists/trees and performing useful operations... lot's of fun!
    Good luck
    Jim

  • Circular Linked List

    Hello,
    I am working with circular linked Lists. Now the thing is that my assignment was to make this. I had to write a set of methods. Now the thing is that I had to write a method that removes the last value. I made it but it doesnt wark and also i am confused
    public Object removeFirst()
             if(size()==0)
                return "empty list";
             Object temp = last.getNext().getValue();
             last.setNext(last.getNext().getNext());
             size--;
             return temp;
          //doesnt Work
           public Object removeLast()
              public Object removeLast()
             if (size()==0)
                return "empty list";
             Object temp= null;
             temp = last.getNext().getValue();
             last = last.getNext();
             size--;
             return temp;  
          }

    Well what is wrong with the code?
    Does it compile?
    Does it throw an error at runtime?
    Does it give you an unexpected answer?
    For solving problems like this with next/prev "pointers" I find diagramming boxes with arrows to help understand is an absolute requirement. Try figuring it out on paper.
    If you are removing the last item in the list, that means that the item directly before this one, has to the next one in the list
    Assuming you have a structure like this:
    ...-->  (n-1)  -->  (n)  --> (1) --> (2) -->...(n-1)Then removing item (n) you have to make (n-1) point at item (1) as item (n-1) becomes the new "last"
    So you have to have the item before the "last" element to keep the next/prev pointers correct.

  • Sort Linked List...

    I need help sorting a linked list.
    So far, in my sort method I have...
    public LinkedList sort();
    LinkedList newList = new LinkedList();
    Node ref;
    Node temp = new Node(head.getempID(); head.getempLast(), head.getempFirst(); head.getempDept(), head.getempSalary());
    for(ref = head; ref != null; ref.getNext());
    if(ref.getempID() <= temp.getEmpID());
    temp = (ref.getempID(), ref.getempLast(), ref.getempFirst(), ref.getempDept(), ref.getempSalary());
    newList.insert(temp); //???????
    return newList();
    // As you can tell, each one of my node's consists of an employee's id number, last name, first name, department, and salary...I need to sort the linked list by the employee's ID number. I can not figure out how to swap nodes though. PLEASE HELP A KID OUT!!!

    I was worng, my last data structure lecture today(I hope).
          |       |     |       |     |       |     |       |         |       |
    head->| Node1 |---->| Node2 |---->| Node3 |---->| Node4 |---etc-->| NodeN |->null
          |       |     |       |     |       |     |       |         |       |
    Q: How do you swap node2 with node3?
    A: Think about it!  Look at a picture if thats what you need. Draw the lines of reference to figure it out.
      1. Where does node1.next need to point to, how about node2.next, or node3.next?
      3. How do you change these without losing a node, are you going to need a temp?
      4. What about special case(switching node1 and node2)?
    This is simple problem solving skills.  I assume you have built the list yourself,
    so you have the basic knowledge base needed.

  • Selection Sort using Linked Lists

    As the subject says, I'm trying to implement a selection sort method on a linked list structure. I've already created a bubble sort, but I can't seem to get this method to work correctly. The Node and LinkedList classes were written by me, and I know they work correctly (because of the other methods work right).
    public void selectionSort(LinkedList list) {
            int iterationsINNER = 1, iterationsOUTER = 1, swaps = 0, comparisons = 1;
            if(list.isEmpty())
                System.out.println("List is currently empty.");
            else if (list.size() == 1)
                System.out.println("List is already sorted.");
            else {
                Node pointer = list.getFirst();
                Node current;
                boolean exchangeMade;
                while (pointer.getNext().getNext() != null) {
                    current = pointer;
                    exchangeMade = false;
                    iterationsOUTER++;
                    while (current.getNext() != null && !exchangeMade) {
                        if(current.getNext().getData() < pointer.getData()) {
                            int temp = pointer.getData();
                            pointer.setData(current.getNext().getData());
                            current.getNext().setData(temp);
                            exchangeMade = true;
                            iterationsINNER++;
                            swaps++;
                            comparisons++;
                        current = current.getNext();
                    pointer = pointer.getNext();
              //  System.out.println("Comparisons: " + comparisons + " \nSwaps: " + swaps + " \nIterations: " + iterationsINNER+iterationsOUTER);
        }For instance, if I run this bit of code...
    LinkedList list = new LinkedList();
            list.insert(5);
            list.insert(29);
            list.insert(2);
            list.insert(1);
            list.insert(13);
            list.insert(8);
            list.insert(30);
            list.insert(3);
            sort.selectionSort(list);
            list.print();The output is...
    1
    8
    13
    3
    2
    29
    30
    5
    Anyone have any idea what is going wrong, or is anymore information needed?
    PS: I also need to create a insertion sort method with this, and I've been told I need to reverse the list for the insertion sort to work correctly. Any tips on how to implement this method too? :)

    I've changed it up a bit, and it works, but is this still a bubble sort? I've tried uncommenting that section that keeps track of the iterations and such, but I know they can't be right. Does this look correct? I basically just removed that boolean check...
    public void selectionSort(LinkedList list) {
            int iterationsINNER = 1, iterationsOUTER = 1, swaps = 0, comparisons = 1;
            if(list.isEmpty())
                System.out.println("List is currently empty.");
            else if (list.size() == 1)
                System.out.println("List is already sorted.");
            else {
                Node pointer = list.getFirst();
                Node current;
                while (pointer.getNext() != null) {
                    current = pointer;
                    iterationsOUTER++;
                    while (current.getNext() != null) {
                        comparisons++;
                        if(current.getNext().getData() < pointer.getData()) {
                            int temp = pointer.getData();
                            pointer.setData(current.getNext().getData());
                            current.getNext().setData(temp);
                            iterationsINNER++;
                            swaps++;
                        current = current.getNext();
                    pointer = pointer.getNext();
                System.out.println("Comparisons: " + comparisons + " \nSwaps: " + swaps + " \nIterations: " + iterationsINNER+iterationsOUTER);
        }And no, I tried and I don't get a NullPointerException if I have a list of 2.
    Edited by: birdboy30 on Dec 3, 2007 7:23 PM

  • Is my code a Linked Lists or not?

    Hello everyone,
    [I hope I am in the right forum]
    I am trying to learn how to implement Linked Lists with Java. I have written a small code and I would appreceate it a lot if any one would be kind enough to check if this code is really a linked list.
    I tried to make a list with 3 nodes, with no helping methods for adding and removing nodes. Just a simple example. This is my code:
    public class myList{
         public static final long serialVersionUID = 24362462L;
         //node pointer important to define private, so not share same value
         private myList pointer;
         //node data
         private String nodeData;
    public static void main(String args[]){
    //Give memory to nodes
    myList Node1 = new myList();
    myList Node2 = new myList();
    myList Node3 = new myList();
    //Make Node1
    Node1.pointer = Node2;//give value to pointer
    Node1.nodeData = "Hi i am data contained in Node 1.";
    //Make Node2
    Node2.pointer = Node3;
    Node2.nodeData = "Hi i am data contained in Node 2.";
    //Make Node3
    Node3.pointer = null;
    Node3.nodeData = "Hi i am data contained in Node 3.";
    //Display Data
    System.out.println(Node1.nodeData);
    System.out.println(Node2.nodeData);
    System.out.println(Node3.nodeData);
    //Display pointers
    System.out.println("Hi this is Node2 ==============>:"+Node2);
    System.out.println("This is the value of pointer of Node1:"+Node1.pointer);
    System.out.println("Hi this is Node3===============>:"+Node3);
    System.out.println("This is the value of pointer of Node2:"+Node2.pointer);
    }//main
    }//class
    /***** OUTPUT ***** OUTPUT ***** OUTPUT ***** OUTPUT *****
    Hi i am data contained in Node 1.
    Hi i am data contained in Node 2.
    Hi i am data contained in Node 3.
    Hi this is Node2 ========================>:myList@16f0472
    This is the value of pointer of Node 1 ==>:myList@16f0472
    Hi this is Node3 ========================>:myList@18d107f
    This is the value of pointer of Node 2 ==>:myList@18d107f
    Press any key to continue...
    Thank you very much,
    JMelsi

    Happy to advise. Here we go. :)
    Firstly, you'll want to post your code in code tags. They make your code more legible, thus making it easier and therefore more likely that someone responds. ;)
    Second, it would be more appropriate for class names (such as "myList") to start with an upper-case letter (such as "MyList"). Additionally, the class in question does not represent a whole list but instead a node, so you might want to call it "MyListNode" or something similar.
    Strictly speaking, your code is definitely that of a linked list of nodes. For example, one could print all of the contents in your list with code like this:
    myList node = ...; // assign to the first node
    while (node!=null) // as long as there is a node
        System.out.println(node.nodeData); // print the data in this node
        node = node.pointer; // move on to the next node
    }Note that, in the above code, I didn't have to know how many nodes were in your list or have any references to them beforehand. :) That's the power in the data structure you're creating.
    Enjoy!

  • Constucting Doubly Linked Lists

    Hi,
    I'm trying to construct a doubly linked list with three nodes. I'm using the following code for the DLL and DLLNode classes:
    public class DLL
         public DLLNode first, last;
         public DLL()
         this.first = null;
         this.last = null;
    public class DLLNode
         protected Object element;
         protected DLLNode pred, succ;
         public DLLNode (Object elem, DLLNode pred, DLLNode succ)
         this.element = elem;
         this.pred = pred;
         this.succ = succ;
    }          and for the driver to create the DLL:
    class CreateDLLNode
    public static void main(String arg[])
         DLL zoo = new DLL();
         zoo.first = new DLLNode("ant", null, new DLLNode("bat", zoo.first, zoo.last));
         zoo.last = new DLLNode("cat",zoo.first.succ, null);
         System.out.println(zoo.first.succ.succ.element);
    }However when I run the above driver I just a null pointer exception when it tried to print the third element (i.e. cat, first's successor's successor) I've figured out that this is because the link pointing from Bat to Cat isn't there, likewise the link from Bat to Ant isn't there (get another exception if I try to print zoo.last.pred.pred). I know there's something wrong with the way I've created the DLL but I don't know what.
    I'd be very grateful for any help anyone can give, thanks!

    When you assign one variable to another (ie: thisVar=thatVar) it does not mean that thisVar will always contain whatever thatVar contains. thisVar only has what thatVar contained at the moment of the assignment.
    thisVar = 1;
    thatVar = 2;
    thisVar = thatVar;
    thatVar = 3;At the end of the above code, thisVar = 2 and thatVar = 3; thisVar does NOT equal 3.
    When you set the bat's successor to zoo.last, zoo.last is null at that moment, so bat's successor will be null. That's the basic idea of where you're going wrong with that part specifically.
    If you're going to go to the trouble of creating an abstract data structure, make the structure itself handle all these things. Give it an add() method with a parameter that accepts the objects. add() can then create a new node and supply the node the information about its previous/next nodes, and then the DLL can also change its own first/last if necessary.
    You should not have to change any of the properties of DLL outside of the DLL. When you do, you start running into problems like the one you have here.
    // assuming add at end of list
    DLL's add(elem)
        last.succ = new node(elem, last, null)
        last = last.succ
    // add in middle
    DLL's add(elem, afterThisNode)
        afterThisNode.succ = new node(elem, afterThisNode, afterThisNode.succ)
        if(afterThisNode.succ.succ)
            afterThisNode.succ.succ.pred = afterThisNodeThen you'll also need versions for where elem is going in position #1 or if it's going to be the first thing in the DLL.
    Another problem with your code too though...
    If you do "thisVar = new object( new object(thisVar))" then the "thisVar" being passed to the inner new object will have the original value of thisVar, not the value which references the outer new object. When your new bat is being made, the pred you're passing to it is also null.

  • After Delete in Linked list...unable to display the linked list

    Hi...i know that there is an implementation of the class Linked Link but i am required to show how the linked list works in this case for my project...please help...
    Yes..I tried to delete some objects in a linked list but after that i am not able to display the objects that were already in the linked list properly and instead it throws an NullPointerException.
    Below shows the relevant coding for deleting and listing the linked list...
    public Node remove(Comparator comparer) throws Exception {
         boolean found = false;
         Node prevnode = head;          //the node before the nextnode
         Node deletedNode = null;     //node deleted...
         //get next node and apply removal criteria
         for(Node nextnode = head.getNextNode(); nextnode != null; nextnode = nextnode.getNextNode()) {
              if(comparer.equals(nextnode)) {
                   found = true;
                   //remove the next node from the list and return it
                   prevnode.setNextNode(nextnode.getNextNode());
                   nextnode.setNextNode(null);
                   deletedNode = nextnode;
                   count = count - 1;
                   break;
         if (found) return deletedNode;
         else throw new Exception ("Not found !!!");
    public Object[] list() {
         //code to gather information into object array
         Node node;
         Object[] nodes = new Object[count];
         node = head.getNextNode();
         for (int i=0; i<count; i++) {
              nodes[i] = node.getInformation();  // this is the line that cause runtime error after deleting...but before deleting, it works without problem.
              node = node.getNextNode();
         return nodes;
    }Please help me in figuring out what went wrong with that line...so far i really can't see any problem with it but it still throws a NullPointerException
    Thanks

    OK -- I've had a cup and my systems are coming back on line...
    The problem looks to be the way that you are handling the pointer to the previous node in your deletion code. Essentially, that is not getting incremented along with the nextNode -- it is always pointing to head. So when you find the node to delete then the line
       prevnode.setNextNode(nextnode.getNextNode());will set the nextNode for head to be null in certain situations (like if you are removing the tail, for instance).
    Then when you try to print out the list, the first call you make is
    node = head.getNextNode();Which has been set to null, so you get an NPE when you try to access the information.
    Nothing like my favorite alkaloid to help things along on a Monday morning...
    - N

  • Problem with Queue and linked list

    Hi... i've got an assignment it start like this.
    You are required to write a complete console program in java includin main() to demonstrate the following:
    Data Structure: Queue, Priority Queue
    Object Involved: Linked-List, PrintJob
    Operations Involved:
    1. insert
    2. remove
    3. reset
    4. search
    Dats all... I've been given this much information... Can any1 try to help me please... How to make a start??? And wat does the print job means???
    Can any1 tell me wat am supposed to do...

    Hi,
    Why don't you start your demo like this?
    import java.io.IOException;
    public class Demo {
         public Demo() {
         public void startDemo() throws IOException {
              do {
                   System.out.println("String Console Demo ");
                   System.out.println("\t" + "1. Queue Demo");
                   System.out.println("\t" + "2. PriorityQueue Demo");
                   System.out.println("\t" + "3. LinkedList Demo");
                   System.out.println("\t" + "4. PrintJob Demo");
                   System.out.println("Please choose one option");
                   choice = (char) System.in.read();
                   showDemo(choice);
              } while (choice < '1' || choice > '4');
         public void showDemo(char ch) {
              switch (ch) {
              case '1':
                   System.out.println("You have chosen Queue Demo ");
                   showOperations();
                   break;
              case '2':
                   System.out.println("You have chosen Priority Queue Demo ");
                   showOperations();
                   break;
              case '3':
                   System.out.println("You have chosen LinkedList Demo ");
                   showOperations();
                   break;
              case '4':
                   System.out.println("You have chosen Print Job Demo ");
                   showOperations();
                   break;
         private void showOperations() {
              System.out.println("Please choose any operations ");
              System.out.println("\t" + "1. Insert ");
              System.out.println("\t" + "2. Remove ");
              System.out.println("\t" + "3. Reset ");
              System.out.println("\t" + "4. search ");
         public static void main(String[] args) throws IOException {
              Demo demo = new Demo();
              demo.startDemo();
         private char choice;
    Write a separate classes for the data structures show the initial elements and call the methods based on the operations then show the result.
    Thanks

  • How to print the contents of doubly-Linked List

    Hi
    I have a DLList consists of header , trailer and 10 linked nodes in between
    Is there a simple way to print the contents ie "the elements"
    of the list
    thanks

    In general you should write an iterator for every linked data structure for fast traversal. I'm guessing you're writing your own DLL for an assignment because one normally uses the LinkedList structure that is included in the api. Anyway, here is an example of how the iterator is implemented for a double linked list:
    http://www.theparticle.com/_javadata2.html#Doubly_Linked_Lists_with_Enumeration

  • How to add SharePoint 2013 Promoted link list view web part in page programatically with Tiles view using CSOM.

    How to add SharePoint 2013 Promoted link list view web part in page programatically with Tiles view using CSOM. I found that it can be
    done by using XsltListViewWebPart class but how can I use this one by using shraepoint client api.
    shiv

    Nice, can you point me to the solution please ?
    I'm  trying to do this but I get an error : 
    Web Part Error: Cannot complete this action. Please try again. Correlation ID: blablabla
    StackTrace:    at Microsoft.SharePoint.SPViewCollection.EnsureViewSchema(Boolean fullBlownSchema, Boolean bNeedInitallViews)     at Microsoft.SharePoint.SPList.GetView(Guid viewGuid)   
    All help really appreciated.

Maybe you are looking for

  • HELP! computer crashed.. lost music.. ipod wont let me put new songs on

    Okay my computer crashed... now i got it fixed and i have the few hundred songs on my ipod... no longer on computer now every time i open itunes a note saying something to the extent of the ipod is registerd on another computer do i want to erase all

  • PS image to InDesign.

    How do I make the PS background transparent. I just want the radio to be visible in front of another graphic. TIA.

  • ITunes 10 not playing music

    Hi all! I just upgraded to iTunes 10 and no music is playing either in my library or in the iTunes store whatsoever. iTunes recognizes the length of the song, and I can move the progress bar, but hitting play results in not playing. The progress bar

  • Data Source for DAR01 field in HR.

    Hi Guys, I have the following fields in HR area PA. First three fields are for D.O.J. group and last field is for Date type from table PA0041. I didn't find any info object and data source for these fields in BI. Can any one help me out for finding s

  • BPM performance improving

    Hi everyone Do someone know if there is a way to improve a BPM performance? Or how to speed it up? ´ I don´t know, maybe applying a note, setting a parameter, etc... Thanks in advanced. Emmanuel