How to solve this?

This is what I want to do.
I have an ArrayList with lot of elements (e.g. 1003)
I want to get 100 elements out of this list as a new list each time.
0 to 99
100 to 199
900 to 999
1000 to 1002
But my code gives me only upto 1000. It is not getting me 1001,1002 and 1003. I could not figure out why?
Help me to identify and fix the bug.
//CODE SNIPPET
List ids =new ArrayList();
// ids gets more than 100 elements (e.g. 1003)
try{
     List id =new ArrayList(); //new list with max 100 elements
     for(int i = 0; i < ids.size(); i++) {
     for (int j=0; j<100; j++){
          id.add(ids.get(j));
List ls = someMethod(id);
     for(int l = 0; l< ls.size(); l++) {
//do something with each element
otherMethod(ls.get(l));     
     ids.subList(0,100).clear(); //removes the first 100 element from ids
          id.clear(); //empty the list id with 100 elements
     }catch(InterruptedException e){
     System.out.println(e);

Are you sure about what does this snippet??
try{
  List id =new ArrayList(); //new list with max 100 elements
  for(int i = 0; i < ids.size(); i++){
    for (int j=0; j<100; j++)
      id.add(ids.get(j));
  }I don't think that what you want it's to add to the id List the first 100 elements of ids for each element it has

Similar Messages

  • I recieve SMS and i hear established melody and I do't hear the person on all over SMS. How to solve this problem?

    Problem with an incoming message. For example, during my conversation the second line receives a call, I hear the sound in dynamics such as "piiiip piiiip," but when in this situation I recieve SMS and i hear established melody and I do't hear the person on all over SMS. How to solve this problem? Perhaps someone tell me? save in advance

    Not Charge
    - See:     
    iPod touch: Hardware troubleshooting
    iPhone and iPod touch: Charging the battery
    - Try another cable. The cable for 5G iPod (lightning connector) seems to be more prone to failure than the older cable.
    - Try another charging source
    - Inspect the dock connector on the iPod for bent or missing contacts, foreign material, corroded contacts, broken, missing or cracked plastic.
    - Make an appointment at the Genius Bar of an Apple store.
      Apple Retail Store - Genius Bar

  • I'm trying to connect my 30" Cinema Display to my new Mac Pro along with a new Apple 23'" monitor.  The new Apple monitor is fine.  On the cinema monitor everything is blown up pretty large.  Any ideas on how to solve this?

    I'm trying to connect my 30" Cinema Display to my new Mac Pro along with a new Apple 23'" monitor.  The new Apple monitor is fine.  On the cinema monitor everything is blown up pretty large.  Any ideas on how to solve this?

    The 30" display needs a DUAL-LINK adapter.
    <http://store.apple.com/us/product/MB571Z/A/mini-displayport-to-dual-link-dvi-ada pter>

  • Hi, when ever I'm using 3G, on my Iphone4 sim stops working and Network is lost, this started after I updated my phone with  6.0.1(10A523)version. Please help how to solve this problem.

    Hi, when ever I'm using 3G, on my Iphone4 sim stops working and network is lost, this started after I updated my phone with  6.0.1(10A523)version. Please help how to solve this problem. Thanks.

    Photos/videos in the Camera Roll are not synced. Photos/videos in the Camera Roll are not touched with the iTunes sync process. Photos/videos in the Camera Roll can be imported by your computer which is not handled by iTunes. Most importing software includes an option to delete the photos/videos from the Camera Roll after the import process is complete. If is my understanding that some Windows import software supports importing photos from the Camera Roll, but not videos. Regardless, the import software should not delete the photos/videos from the Camera Roll unless you set the app to do so.
    Photos/videos in the Camera Roll are included with your iPhone's backup. If you synced your iPhone with iTunes before the videos on the Camera Roll went missing and you haven't synced your iPhone with iTunes since they went missing, you can try restoring the iPhone with iTunes from the iPhone's backup. Don't sync the iPhone with iTunes again and decline the prompt to update the iPhone's backup after selecting Restore.

  • I Try to open an Indesign document. The message: it is made in a newer version. Go tot CC: Help/Give your Adobe id/Start Indesign again and try to open the document. This doesn't work. How to solve this problem?

    I Try to open an Indesign document. The message: it is made in a newer version. Go tot CC: Help/Give your Adobe id/Start Indesign again and try to open the document. This doesn’t work. How to solve this problem?

    What version are you running?
    What version was it made with?

  • After installing Lion os I cannot see my desktop 1 nor can I see my open windows when I go to finder, I just get the grey/black background that comes with mission control. Any ideas as to how to solve this problem?

    The top picture is what my Desktop 1 looks like. And the picture below is what my desktop looks like after clicking mission control. Ive tried changing wallpapers, changing preferences, etc. and I still can't figure out what's wrong. As you can see, on mission control you can't see any of the open windows, or anything that I have placed on my desktop. Any ideas as to how to solve this issue?

    Hello cor-el, thanks for your reply. I changed my settings for downloads to desktop and it has appeared on there. When I double click I am asked which program I want to open file. I click firefox and another box "opening install" says I have chosen to open the file which is an application and do I want to save it. This is the only real option so I press save file. I get a box saying this is an executable file which may contain viruses - do you want to run. I press ok and the final box showing C drive file name and desktop appears stating application not found.
    This happens the same whenever I try to install.
    To my untrained eye the application is not being recognised as an application and I cannot work out how to get it to do that.
    My plugin is still showing as out of date.
    Is there anything you could suggest. Thanks for your time.

  • Hello guys..!! I have got my new  iphone 4 2 days ago.The same day it got a problem of auto restart in every 1, to 2 minutes. I updated and restored it many times...but of no use... can any one help me how to solve this problem..!!

    Hello guys..!! I have got my new  iphone 4 2 days ago.The same day it got a problem of auto restart in every 1, to 2 minutes. I updated and restored it many times...but of no use... can any one help me how to solve this problem..!!

    Go to Settings/General/Reset - Erase all content and settings. the connecto to iTunes and restore as a New phone. Do not restore any backup. If the problem persists you have a hardware problem. Take it to Apple for exchange.
    This assumes that the phone is not hacked or jailbroken. If it is you will have to go elsewhere on the internet for help.

  • TS1702 Does any one know how to solve this iPod touch error: I am tryin to pay for an app but I can because it says that I don't have enough space when I actually have more than enough space to download it so please help me

    Does anyone know how to solve this problem: I a trying to download a paid app but I cannot because the AppStore says that info not have enough space to download it even though I have more than enough space so if any of you know what can solve this problem then please let me know

    The app is compressed and needs swap space to install. As a rule of thumb you need 3 times the listed size of the app available, or in your case 4.6GB. You only have 1.7GB.

  • Iphone 4 is hiting in ios 5.1.1. any one know how to solve this problem??

    iphone 4 is hiting in ios 5.1.1. any one know how to solve this problem??

    This sounds like a hardware problem and should be taken to Apple if the heating / "hiting" becomes disturbing to you. If you feel that your iPhone has a heating / "hiting" problem and needs to be repaired, please contact Apple Support and they can further assist you in having it inspected, repaired, or even replaced. In the past, the overheating of Apple products has been known to cause harmful problems to a few particular users. Please evaluate your situation and take further action if you feel necessary.
    http://www.apple.com/support/contact/

  • Transaction failed for unknown reason (100) Unable to complete backup at this time. Does anyone know how to solve this issue?

    Transaction failed for unknown reason (100) Unable to complete backup at this time. Does anyone know how to solve this issue?
    Thanks.

    The system is set up to backup files to the iCloud at the end of the day. This has ot happen for sometime now and the mesaage I get is the back up error.

  • How to solve this error java.util.MissingResourceException

    Hi Friends,
    I had developed one web dynpro application by using  Internationalization - I18N of WebDynPro (Java)  Application (Blog)   but I got one error that is
    <b>java.util.MissingResourceException: Can't find bundle for base name com.sap.example.language.lang, locale en_US</b> 
    Actually i created two properties file
    1. lang_en.properties
    2. lang_ta.properties
    I stored this two properties file in this package com.sap.example.language
    and this my code in DOInit()
    sessionLocale =  WDClientUser.getCurrentUser().getLocale();
    resourceHandler = ResourceBundle.getBundle("com.sap.example.language.lang",sessionLocale);
         catch (WDUMException e)
         e.printStackTrace();
         wdContext.currentContextElement().setUsername_label(resourceHandler.getString("testview.username"));
         wdContext.currentContextElement().setPassword_label(resourceHandler.getString("testview.password"));
    How to solve this error?
    Guide me.
    Advance Thanks,
    Balaji

    Hi Friends,
    I had developed one web dynpro application by using Internationalization - I18N of WebDynPro -Java Application (Blog) but I got one error that is
    <b>java.util.MissingResourceException: Can't find bundle for base name com.sap.example.language.lang, locale en_US</b>
    Actually i created two properties file
    1. lang_en.properties
    2. lang_ta.properties
    I stored this two properties file in this package com.sap.example.language
    and this my code in DOInit()
    sessionLocale = WDClientUser.getCurrentUser().getLocale();
    resourceHandler = ResourceBundle.getBundle("com.sap.example.language.lang",sessionLocale);
    catch (WDUMException e)
    e.printStackTrace();
    wdContext.currentContextElement().setUsername_label(resourceHandler.getString("testview.username"));
    wdContext.currentContextElement().setPassword_label(resourceHandler.getString("testview.password"));
    How to solve this error?
    Guide me.
    Advance Thanks,
    Balaji

  • Get error message when syching iPod, iPod cannot be synced. You do not have enough access priveleges for this operation.  How to solve this?

    Get error message when syching iPod, iPod cannot be synced. You do not have enough access priveleges for this operation.  How to solve this?

    Hello FranBNYC
    It sounds like a permissions issue with your library, check out the article below to check and make sure that things are set correctly.
    Trouble adding music to iTunes library or importing audio CD
    http://support.apple.com/kb/ts1387
    Thanks for using Apple Support Communities.
    Regards,
    -Norm G.

  • Hi, my Ipod Schuffle (4 gen) dissapears from windows vista right after I execute Itunes, I've change the drive letter, erase temps in App data file, verified USB drivers, etc... Can someone guide on how to solve this?

    Hi, my Ipod Schuffle (4 gen) dissapears from windows vista right after I execute Itunes, I've change the drive letter, erase temps in App data file, verified USB drivers, etc... Can someone guide on how to solve this?

    If you want the shuffle to be always visible in Windows (outside of iTunes), you need to Enable disk use.
    Select the shuffle in the iTunes sidebar, under DEVICES.  Over to the right, select the Summary tab.  You should see a checkbox that says Enable disk use.  Check it and click Apply.
    NOTE:  If disk use is enabled, you have to Eject the shuffle in iTunes, BEFORE you physically disconnect it.  If disk use is NOT enabled, you can disconnect the shuffle at any time, as long as iTunes is not doing something with it at that moment (such as syncing); the shuffle's light will then be blinking (to indicate DO NOT DISCONNECT).
    So, unless you want to use the shuffle like a USB flash drive (carry random files on it), you may want to NOT Enable disk use.

  • I'm using windows 8 on my pc, and i have just downloaded the latest version of itunes, after i upgraded the latest version of itunes, it can't detect my iphone, but my windows/my pc does. Anyone knows how to solve this problem?

    I'm using windows 8 on my pc, and i have just downloaded the latest version of itunes, after i upgraded the latest version of itunes, it can't detect my iphone, but my windows/my pc does. Anyone knows how to solve this problem?

    Hi jstutsman,
    If you are having issues with your iPod nano not being recognized in iTunes after a recent update, you may find the steps and links listed in the following article helpful:
    iPod not appearing in iTunes - Apple Support
    Regards,
    - Brenden

  • My external hard drive will no longer connect to my macpro......any ideas on how to solve this problem??

    My external hard drive will no longer connect to my macbook pro via FW800........Any ideas on how to solve this??

    Reset the SMC, see this Apple note: http://support.apple.com/kb/HT3964
    Also reset the PRAM:
    Shut down the computer.
    Locate the following keys on the keyboard: Command, Option, P, and R. You will need to hold these keys down simultaneously in step 4.
    Turn on the computer.
    Press and hold the Command-Option-P-R keys. You must press this key combination before the gray screen appears.
    Hold the keys down until the computer restarts and you hear the startup sound for the second time.
    Release the keys.
    In most cases, those two actions will fix the port issue. If it's still an issue, you may need to see if the external hard drive can connect to another system, to ensure it's not having problems.

  • How to Solve This in Win8: "Photoshop CS6 has stopped working ... ..."

    Anyone know how to solve this problem?? Please help. It's given me a lot of headache and I need it fixed as soon as possible.
    I have re-installed. And system restore. Everything is up-to-date. And I cannot find the problem to solve it.
    Computer Details:
    Tech Support Guy System Info Utility version 1.0.0.2
    OS Version: Microsoft Windows 8 Pro, 64 bit
    Processor: Intel(R) Core(TM) i7 CPU 960 @ 3.20GHz, Intel64 Family 6 Model 26 Stepping 5
    Processor Count: 8
    RAM: 6142 Mb
    Graphics Card: NVIDIA GeForce GT 240, 1024 Mb
    Hard Drives: C: Total - 122001 MB, Free - 14560 MB; D: Total - 953866 MB, Free - 176631 MB; F: Total - 296441 MB, Free - 8907 MB;
    Motherboard: Gigabyte Technology Co., Ltd., X58A-UD3R
    Antivirus: Windows Defender, Disabled
    Other Details:
    Faulting application name: Photoshop.exe, version: 13.0.0.0, time stamp: 0x4f61c045
    Faulting module name: SelectivePalette.8li, version: 2.1.4.131, time stamp: 0x529e6913
    Exception code: 0xc0000005
    Fault offset: 0x0000000000009582
    Faulting process id: 0x3ac
    Faulting application start time: 0x01cf08a96051f5a5
    Faulting application path: C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)\Photoshop.exe
    Faulting module path: C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)\Plug-ins\Google\Selective Tool\SelectivePalette.8li
    Report Id: a1a5ffce-749c-11e3-bf7b-1c6f65365a00
    Faulting package full name:

    Your Nik/Google SelectivePalette plugin crashed.
    Disable the Nik/Google plugins for now, and contact Nik/Google for updates/bug fixes.

Maybe you are looking for

  • Reference of 103 mat.doc. in  105 doc. , when GR based IV is not selected

    Hi, I required logic, to list out 103 material documents for which movt. 105 is not made , If GR based IV is not selected in PO. We know, each MIGO document has a reference document number. In case of 103 document, the reference document number is th

  • Using PrintWriter for writing to file

    Friends, I am just begginer in Java programming. I am trying to write a message to the Log file as below. It just opens the file but writes nothing to it. What is missing here ? any help is appreciated. FileWriter fw = new FileWriter(new File("Readon

  • Series in CR

    In Crystal report 10, after creating a report on payment voucher with the following query SELECT T0.[TransId], T0.[Series], T5.[SeriesName], T0.[CardCode], T0.[CardName], T0.[Address], T0.[CounterRef], T0.[DocNum], T0.[DocDate], T4.[BankName], T1.[Ac

  • IPhoto 11 is so slow when opening

    Very recently my iPhoto has become so slow when opening, it can take anywhere between 3 and 7 minutes, during this time my Macbook just hangs, I can't use any other programs. I have attempted running the iPhoto first aid, I have picked all of the opt

  • How to reverse the Credit memo in AR if it's created and posted into the GL

    Hi All, Can any one suggest on below issue:- If i have created a credit memo in AR and posted into the GL also. but after that i realizse that i have made a wrong entry now i want to rectify the errror . How do i rectify the entry if i created Credit