Put Linkedlist into arraylist ???

hello,
i have a linkedlist of objects of size 1000. Every object(every node of linked list is an instance of a class) in linkedlist contains of 20 variables. Now i want to take objects from this linkedlist and put it into array list.???
Example: If User says me i want to see linked list between range 30 to 200. So i want to take get object 30 to object 200 from linkedlist. I have decided to put into an array and pass it to my other class which would perform some calculation on these objects. I am unable to get objects from linkedlist and put into array list.

import java.util.*;
public class ListConvert {
    public static void main(String[] args) {
     LinkedList<String> ll = new LinkedList<String>();
     ll.add("test");
     ArrayList<String> al = new ArrayList<String>(ll);
     System.out.println(al.get(0));
}

Similar Messages

  • Saving a LinkedList into a text doc using bufferwriter

    hi
    I'm having some problem attempting to save my linked into a text doc(.txt). By using the scanner class i to read another text doc and have it put each work in that document as an single element in the linkedlist. But when i try to write the linked list into a text doc it only writes the last word / element that is in the linkedlist into a text document. How do i get my bufferwriter or filewrite to same all the words and prehaps in a format that i want?
    import java.util.*;
    import java.io.*;
    public class LibraryLinkedList {
        public static void main(String[] args) throws FileNotFoundException,
       IOException{
          File file1 = new File(args[0]);
            Scanner in = new Scanner(file1);
            LinkedList<String> lst = new LinkedList<String>();
            //... Read and build list of words.
            while (in.hasNext()) {
                String word = in.next();
                lst.add(word);
           ///  loop to print list forward.
            //    Could also use an Iterator (forward only) or
            System.out.println(" Print words in order of entry");
            for (String s : lst) {
                System.out.println(s);
            /// this print statement is for testing
             BufferedWriter out = new BufferedWriter(new FileWriter(
            "s.txt"));
          PrintWriter output = new PrintWriter(out);
          output.print(s);
          output.close();
    }eg.
    1. i have a doc with words("apple chair book house")
    2. i have a testing print statement which prints the words that have been scanned and placed into linked list and it prints it like this
    apple
    chair
    book
    house
    3. then when i attempt to write into a txt doc it only has ("house") in the doc

    hey
    say i wanted to add a numbering system for each linkedlist item, i've used another for loop to try and attempt this but what happens is that it loops too much.
    eg what i wanted was something like
    1. apple 2.house 3. somthing ect
    but what happens is
    1.apple 2.apple 3.apple ... 15.apple 1.house 2.house 3 house..... 15.house
    my code is as follows
    for(String g :lst) {
                for(int i = 1; i < lst.size(); i++){
                //out.write("#" + i); for loop placing numbers and increasing
                out.write(" #"+ i + g);}
      out.write(" "); // add a new line
    out.close();
        }

  • How do I put text into an Edge File that clients can edit easily afterwards

    Hi
    Can anyone explain how I can put text into an edge file (styled with google fonts) and make it so that clients can access the text and update the text as they require?
    Previous suggestion was dynamically loading a .txt file - any instructions would be most appreciated.
    Thanks.

    Hi Resdesign!
    Your code is very useful to learn how to use Json in Adobe Edge Animate!
    But I have a question: why you use ( i ) as argument of the function UpdateInfo and when you recall it you use ( index )?
    $.getJSON('slides.json', function(data){
              //for(var i=0; i<data.length; i++){
    function updateInfo(i){
                        sym.$("photo").css({"background-image": "url('"+data[i].image+"')"});
                        sym.$("pillar").html(data[i].pillar);
                        sym.$("what").html(data[i].what);
                        // position
              index = -1;
              sym.$("btn").click(function(){
              index++;
                        if (index>=5){
                                  index = 0;
              updateInfo(index);
    Many thanks for your attention!
    Davide

  • I am trying to put music into my 3rd gen ipod touch and older ipod shuffle but they do not show up on Itunes when i connect them,what could be the problem?

    i am trying to put music into my 3rd gen ipod touch and older ipod shuffle but neither are popping up on itunes, what could be the problem?

    See
    iOS: Device not recognized in iTunes for Windows
    - I would start with
    Removing and Reinstalling iTunes, QuickTime, and other software components for Windows XP
    or              
    Removing and reinstalling iTunes and other software components for Windows Vista, Windows 7, or Windows 8
    However, after your remove the Apple software components also remove the iCloud Control Panel via Windows Programs and Features app in the Window Control Panel. Then reinstall all the Apple software components
    - New cable and different USB port
    - Run this and see if the results help with determine the cause
    iTunes for Windows: Device Sync Tests
    Also see:
    iPod not recognised by windows iTunes
    Troubleshooting issues with iTunes for Windows updates
    - Try on another computer to help determine if computer or iPod problem

  • My iPhone 4 will NOT show up on iTunes, not even by putting it into recovery mode. Can anyone help me fix this problem? I would like to use iTunes with it.

    I got an iPhone 4 on Thursday.
    I connected it to my PC, a Windows Vista, that day and nothing showed up besides a "camera."
    My computer picked it up as a camera, which I understand is a common occurence in the iPhone.
    After browsing countless youtube videos and Apple Forum Questions, nothing helped.
    I put it into recovery mode by holding on the power and menu button, but when I opened iTunes it still didn't detect anything.
    I feel like I'm almost hurting my iPhone because I turned it off and on so many times, and plugged it in and out several times, and so forth.
    Here is what happened after putting it into recovery mode: 1. A Windows "device locator" popped up. 2. It was looking for a solution to help me with the unknown device, or iPhone. 3. I clicked onto the find solution button, and it told me that I needed a disc.
    --- I didn't have a disc, so I looked up this problem and it told me to manually find Apple mobile device support on my driver, so I did.---
    4. I then went onto Control Panel and clicked on SYSTEM and MAINTENANCE and went to DEVICE MANAGER.
    5. There I found my iPhone listed under USB controllers.
    6. I uninstalled and installed it several times.
    7. I then manually found a program to ease the problem. The program was "apple mobile device support," which was located on my apple driver.
    8. Nothing happened, besides it reporting to me that Apple USB was found and that "code 39" or "code 1" was in the way.
    9. I didn't know what to do with this....
    By this time, I was about to give up on my iPhone and return it back to the store.
    I tried again, but in a different way this time.
    1. I put it back into recovery mode and I opened itunes.
    2. itunes reported to me that some burning or CD/Drive software was missing and that I needed to reinstall it.
    3. SO, I reinstalled it several times, about 12 (iTunes), and nothing changed.
    4. I then looked up the problem of why the CD/Drive software problem kept popping up.
    5. I fixed it by going to my registry and adding an UpperFilter with the code GEARaspi...something like that.
    6. The problem was fixed, but still no iPhone onto my itunes.
    I stayed up all night last night to fix this problem...I'm annoyed and tired.
    I tried another problem to fix this.
    1. I didn't put it into recovery mode.
    2. My iPhone showed up under portable devices under "device manager," from SYS/MAIN"
    3. I did update software.
    4. I clicked on "apple mobile device support" but nothing happened.
    5. It reported to me of the Code thing again.
    I even called the Apple people and they didn't know what to do, so I stopped calling them...because they only had limited options to fix the problem.
    Can anyone help me?

    There's a whole lot to read in your post, and frankly I have not read it all.
    Having said that, this troubleshooting guide should help:
    http://support.apple.com/kb/TS1538
    In particular, pay attention to the mobile device support sections near the bottom, assuming you have already done the items above it.

  • How do I get the pictures folders in photoshop 7 out of My window XP computer and put them into my new computer windows 8 photoshop12

    How do I get the pictures folders in photoshop 7 out of My window XP computer and put them into my new computer windows 8 photoshop12

    I am so sorry for you and your situation. Were you using iCloud photostream?
    Otherwise I do not see any chance for your precious photos.
    Congrats anyway on the little darling!

  • When I download firefox, using recommended setting, or my own, all the sub files/folders like plugins, modules, updater end up on the desktop as well as in the file location. And when I try to put them into the file location, they don't. And when I delete

    When I download firefox, using recommended setting, or my own, all the sub files/folders like plugins, modules, updater end up on the desktop as well as in the file location. And when I try to put them into the file location, they don't. And when I delete them, FireFox won't open. I tried deleting FireFox and reinstalling it multiple times, and a message pops up sometimes that says FireFox may not have installed correctly, so I follow the steps, but all the extra icons on my desktop don't go away. This has happened every time I have downloaded FireFox. The browser itself works, but I need to know how to get rid of these icons, but still be able to use FireFox. This is on a new computer, with Windows 7.
    == I downloaded FireFox. ==
    == User Agent ==
    Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6

    Managed to solve this myself. Just went to properties > hidden.

  • I can't seem to get my iMac (late 2009 model) into automatic sleep mode.  If I manually put it into sleep I don't have any issues.  I used to solve the issue by running "PleaseSleep" application but that doesn't work anymore since Lion.

    I can't seem to get my iMac (late 2009 model) into automatic sleep mode.  If I manually put it into sleep I don't have any issues.
    I used to solve the issue by running "PleaseSleep" application but that doesn't work anymore since Lion. I now want to fix the underlying problem.
    I'm not running any weird background processes and in my energy saver settings I've tagged "put the hard disk to sleep when possible:, "allow power button to put computer to sleep" and "automatically reduce brigthness". All pretty standard.
    Is there anyone who can give me some pointers ?

    Today I solved the same problem for my iMac running Snow Leopard. See https://discussions.apple.com/thread/3008791#15947706. The method may help you, too.
    For me it was the DynDNS Updater preventing my iMac from automatically entering sleep mode.
    To my knowledge the cause of this sleep problem can only be a peripheral device or a process. So I suggest to first unplug all peripherals and test whether that's the cause. If not, I suggest to terminate one process after another and to test automatic entering of sleep mode after each. Start with user processes; continue with system process if necessary.
    At least that's the way I found the offending process. Fortunately, I was able to change the configuration of that process to allow again automatic entering of sleep mode.
    Good luck!

  • How do I put data into a template using the Labview report generation toolkit for Microsoft Office?

    I am running Lookout 5.0 and have recently purchased the Labview Report Generation Toolkit for Microsoft Office to create reports from my Lookout logged data. Since I have never used Labview I am having my problems. I tried following the tutorials but they do not seem to be examples of what I want to do.
    I log rainfall totals (1 spreadsheet)in Lookout from 40 different sites in 5 minute increments. I copy these totals and paste them into another spreadsheet which sums them up to give me hourly totals and then paste those totals into a spreadsheet for distribution.
    In Labview I create a new report and use the distribution sheet as my template, but how do I complete
    the steps of loading the raw 5 minute data into labview and then paste it into the hourly total spreadsheet and then transfer those totals into the distribution template?
    I have been trying to figure this out for over a week, and I am getting nowhere.
    Any response would be appreciated.
    Thanks
    Jason P
    Jason Phillips

    Lookout saves the files in .csv form which can be opened in Excel. I did make some progress by using the "append table to report" vi which allowed me to put values into an array and then those values were entered into my template on my report vi.
    Where I am stuck now is I want to be able to put values into my template from a .csv file, not from an array I have to manually put numbers in.
    Once those values are in my template I want to pull summed values from the template and place them into a final excel file for printing.
    I have attached examples of the files I am working with to help you better understand what I am trying to do.
    I hope that makes sense.
    Jason Phillips
    Attachments:
    HourlyTotalsTemplate.xls ‏120 KB
    eb_rain_gauge_ss.csv ‏23 KB
    EastBankHourlyRainReport.xls ‏28 KB

  • My iphone 4 wont turn on. it justr randomnly turned off and i have tried to hold the home and sleep buttons for a minute and also tried to put it into recovery mode but nothing is working?

    my iphone 4 wont turn on. it justr randomnly turned off and i have tried to hold the home and sleep buttons for a minute and also tried to put it into recovery mode but nothing is working?

    See Here  >  http://support.apple.com/kb/HT1808
    You may need to try this More than Once...
    Be sure to Follow ALL the Steps...
    But... if the Device has been Modified... this will Not necessarily work.

  • HT1212 I have an iphone 3 which has been disabled, I've put it into recovery mode but itunes won't connect to it. I know the password but the device wn't give me the option to add it. What else can I do to enable the device. I can't wipe it from the cloud

    I have an iphone 3G which has been disabled after a child tried to get into it. Itunes will not connect until I have put the passcode in but the device will only enable emergency calls and does not allow a passcode to be put in. I have put it into recovery mode and itunes can't see it. There is currently no SIM card in it and it's not connectng to the wifi so I can't wipe it from the cloud. Any ideas how I can get into it?

    iPhones require a SIM for activation.
    Put the device in DFU mode (google it) and restore via iTunes.

  • HT2729 How can I put songs into the album they came from but were split because of multiple artists on a tune?

    I need help in finding out home to combine songs from the same CD into one Album. When putting CD into the iMac, it auto loads into iTunes. If the artist is singing duet and the songs show more than one artist, it gets separated in iTunes. I want to combine all tracks together like they are on the CD.

    One way around this is to edit the album info for each song on that album and make the album artist 'various artists', or you can remove that duet artist and make all the artists the same.
    Seems to be a glitch or change with how iTunes sees albums now. THey alphabetize them by artist and, as you've noticed, if the artists are different, it sees them as different albums.
    I had many albums like this and spent a whole weekend editing the info to 'various' to clean it up.

  • How do I take data from a data grid and put it into a variable?

    I am having problems taking data from a datagrid (guess you got that from the title) and setting it to a variable. I am tak
    ing the data from 3 different rss feeds, depending on what button you press, and showing it in a grid. I would like to be able to do more with this data. Here is my code so far:
    <mx:VBox id="vbox" x="70" y="150">
      <mx:Label text="This Data Grid is doing nothing" />
      <mx:DataGrid width="1000" dataProvider="{fullXML}">
       <mx:columns>
        <mx:DataGridColumn id="dataGrid" *dataField="channel.description" headerText="Feed"/>
       </mx:columns>
      </mx:DataGrid>
    </mx:VBox>
    <!-- from test 5 -->
    <mx:Move id="moved" target="{hbox}" repeatCount="0" easingFunction="mx.effects.easing.Linear.easeIn" />
    <mx:HBox id="hbox" fontSize="12" fontFamily="courier">
      <mx:Label text="{website**}" />
    </mx:HBox>
    * this is the data I want to get out
    ** this is where I want to be able to put the variable.
    I don't know if I can do it here or if I need a function or what.
    I would like to be able to put it into an array, but step one is anything at all, so I'm trying just a variable.

    Where do I put that line of code? I see that it goes at the Script part near the top, but how can I use that, I am pretty new to this language. I am not familiar with this line, where does it bind the value from the datagrid to the variable?
    fullXML[myDataGrid.selectedIndex].FIELD_NAME;
    myDataGrid would be the id from the grid I am guessing?
    and selected index would be the channel.description part?
    and FIELD_NAME; is the variable name?
    does this go into a funtion or is it placed at the top where the variables are declared?

  • I got some books from the itunes store and put them into my library.  I created a playlist so that I could burn them to cds.  The title is there but no contents.  It won't even play the playlist.  How do I get the contents of the book?

    I got some books from the itunes store and put them into my library.  I created a playlist so that I could burn them to cds.  It won't even play the book, there are no contents.  How do I get the contents of the book?

    I'm guessing this is a problem unique to me as there have been no replies at all...  Thanks a bunch folks

  • How do I keep itunes from putting things into the cloud after I've downloaded them?

    Hello - Not everyone lives in Silicon Valley or New York City.  I have a relatively slow internet connection so it takes about 2 hours to download a 45-minute tv episode.  Yesterday I did that, and today I went to watch it and it had been put back in the cloud!  "No problem," says Apple, "You can download it again."  It takes f**** 2 hours to download it again.  How can I keep Itunes from putting things I've already downloaded back into the cloud?

    How do I keep itunes from putting things into the cloud after I've downloaded them?
    You don't. They are in the cloud as soon as you make a purchase. As in immediately/right now. They don't get uploaded from yoru computer to the cloud.
    Did you delete it after you watched it?

Maybe you are looking for

  • Browser scrollbars annoying

    Does anyone know what the annoying scrollbar on the side of Chrome and other browsers is called and how to remove it? MBA, Mavericks, Chrome.

  • UPDATING THE OUTBOUND DELIVERY

    Hi ABAP Gurus, I have one urgent requirement as below,    Outbound delivery gets updated/picked for the quantities as stated in the related inbound delivery via BAPI_OUTB_DELIVERY_CHANGE or WS_LM_GOODS_MOVEMENT , or WS_DELIVERY_UPDATE. 1.1.1.2.      

  • Should I Bother Buying New iMac, Final Cut?

    I currently own a seven-year-old G5 running 10.4.11. I'm using FCS and have been trying to upgrade to FCS2 since buying it several months ago, but it won't recognize the serial number from FCS, but that's not my problem/question. I desperately need t

  • Problems since Sunday

    Feb 14 21:53:11 2012 ERR 2012-02-14T21:53:11Z cwmp: mt_cwmp: session error: Could not resolve host Feb 14 21:53:11 2012 INF 2012-02-14T21:53:11Z cwmp: mt_cwmp: session not established, will retry in 30 seconds Feb 14 21:53:11 2012 INF 2012-02-14T21:5

  • CD/DVD drive mac book pro

    I tried to put a cd in and it just instantly spat it out. i thought it was the cd but it worked on my friends macbook pro. I watched a movie on it not two weeks ago and it worked perfectly now it doesnt even take anything. any suggestions??