Make a list with the last 100 added items

Anybody knows how to have a List that only store the last 100 added items? A kind of a que which always has 100 items.
Thank you !
ostense

I am sure there is a simpler way to do what you are trying to do but ...
public class LastList extends LinkedList {
    private final int maxSize;
    public LastList(int maxSize) {
        this.maxSize = maxSize;
    public void addFirst(Object o) {
        super.addFirst(o);
        trim();
    public void addLast(Object o) {
        super.addLast(o);
        trim();
    public boolean add(Object o) {
        boolean ret = super.add(o);
        trim();
        return ret;
    public boolean addAll(Collection c) {
        boolean ret = super.addAll(c);
        trim();
        return ret;
    public boolean addAll(int index, Collection c) {
        boolean ret = super.addAll(index, c);
        trim();
        return ret;
    public void add(int index, Object element) {
        super.add(index, element);
        trim();
    private void trim() {
        while(size() > maxSize)
            removeFirst();
}

Similar Messages

  • Make a list with the customers E-MAIL

    I want to make a list with the emails that i have editrd in customers . How can i do this ?
    I see that in KNA1 there isn't the email address .
    Please help .....

    Hi..
    In table <b>ADR6</b>  u can find email addresses...
    <b>SMTP_ADDR</b> is the field..
    data:
      begin of itab occurs 0,
         f1 type kna1-ADRNR ,
         f2 type ADR6-SMTP_ADDR
      end of itab.
    select kna1~ADRNR
           ADR6~SMTP_ADDR
      from ( kna1 inner join adr6
        on kna1adrnr = adr6ADDRNUMBER )
        into table itab.
    Ram
    Message was edited by:
            Rammohan Nagam

  • How: can i get a specificated item from a list with more than 100.000 items

    Hi,
    i have a very large list and i got always an exception that the list has more than 5000 items and cant query!! But in the default list view i can see, order and filter all items. So how can i do this by c#?

    Hi,
    According to your description, my understanding is that you want to get a specific list item form a list which with more than 100000 items using C#.
    I suggest you can use CAML Query with some condition and set Row Limit to specify the number of items to return.
    Here is a detailed code demo for your reference:
    Client Object Model Access Large Lists/Overcome ListView Threshold while accessing large list
    Thanks
    Best Regards
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Making an average of the last 100 values?

    Hi everyone,
    I am acquiring a signal every 1000mS with Labview 7.1. I need to make an average of the last 100 values every 1000mS. I know how to do this with shift registers but it would be a bit long to do it this way...There must be a better way
    Would anybody have an example of an array that takes into consideration the new value that has just been acquired, so that I can make an average of the array?
    Thank you very much for your help,
    Toto

    Hi Toto,
    Here is the first thing I thought of.  Initialize an array of 1000 elements, and replace an element each iteration of the loop.  Use the Quotient and Remainder function along with the iteration count of the loop to replace the oldest element in the array.  Add the array and divide by 1000 in each iteration to get the current average.  I've attached the VI (saved in LabVIEW 7.1), along with a screenshot for anyone who wants to see it but doesn't have LabVIEW 7.1 or later.
    Good luck,
    -D
    Message Edited by Darren on 02-05-2006 07:40 PM
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman
    Attachments:
    Running_average.vi ‏11 KB
    Running_average.jpg ‏32 KB

  • How can i delete the new feature "get in contact with your favourite persons"?? When u press the "home" button twice, theres a list on top of the ipad with the last persons youve been in contact with. How do i delete that, or some of them ;-)

    How can i delete the new feature "get in contact with your favourite persons"?? When u press the "home" button twice, theres a list on top of the ipad with the last persons youve been in contact with. How do i delete that, or some of them ;-) Sorry for the danish  

    You can turn that feature off in Settings>Mail, contacts, calendars>Contacts>Show in App Switcher>Recents>Off.

  • I am creating webpages with frontpage and trying to make collapsible lists. The lists collapse and work correctly in "preview" mode, but do not work when accessed through firefox or explorer 8. Does anyone know what I am doing wrong?

    I am creating webpages with frontpage and trying to make collapsible lists. The lists collapse and work correctly in "preview" mode, but do not work when accessed through firefox or explorer 8. Does anyone know what I am doing wrong?

    Welcome to the 'wonderful' world of HTML5 e-learning.
    In my view, from the issues I am seeing everywhere, HTML5 output from rapid e-learning tools such as Captivate is not ready for the kind of mobile device e-learning you want to develop.
    Sorry to be pessimistic, but you may need to consider going back to the drawing board and coding it from the ground up.

  • The style 'dropShadowVisible' is only supported by type 'mx.controls.List' with the themes(s) 'spark

    I'm still plagued by these warnings in my Flex project:-
    The style 'dropShadowVisible' is only supported by type 'mx.controls.List' with the themes(s) 'spark'
    Clicking on the warnings doesn't take me to the code.
    The project started as SDK3.5.  I've made it into an SDK4.0 project.  It uses old Halo components throughout.  I've chosen a Halo theme.
    I can get rid of these warnings if I "Use Flex 3 compatibility mode".  BUT, If I use that mode, I get also Run Time Errors - so I decided against this compatibility, and just edited the styling, deprecated syntax, and a few issues to make the app work.
    I tried the solution someone suggested editing the flex-config.xml file, but it didn't work for me.
    The application begins...
    <mx:Application
    xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    xmlns:s="library://ns.adobe.com/flex/spark"
    (I've obviously tried clean).

    Yes, very irritating. "Only a warning" isn't the whole story, it's more than just an annoyance, it can potentially make all warnings useless.
    Imagine cases where you have multiple warnings (often FB warnings turn up for EACH component resulting in many repeats, design mode is particularly bad with this).  Having a ton of warnings that "aren't really warnings" obscures REAL warnings that we'd want to do something about (and makes errors harder to notice at first--you're so used to always seeing lines under the problems tab that you don't always notice a new error that just popped up).  In the worst case scenario a valid warning that would have prevented a bug is missed and something goes to QA or production that should have been caught at compile time...
    This wouldn't be nearly as annoying if we had some decent way of filtering these warnings from the problems tab. The current filter isn't good enough and only seems to allow you to filter out one message due to the way it works, but sometimes we see more than one type of "bogus" warning.
    Voted and added to comments.  I wonder if there's a feature request out there to improve warning filter capabilities?  I also wonder why nobody complained about this before, it seems pretty easily visible.  Is it the norm for people to just always ignore warnings?  This isn't a good practice, warnings tend to exist for a reason.
    (Btw, this is part of my reasoning for the claim that Halo seems to have become a "second class citizen" component set - hopefully Adobe can do something about this.)

  • Lightroom 4 crashes when trying to open the slideshow module. I spent over three hours with both Adobe and Apple tech support and we know it is a permission issue but have not been able to get it solved.  It started with the last upgrade to 10.8

    Lightroom 4 crashes when trying to open the slideshow module. I spent over three hours with both Adobe and Apple tech support and we know it is a permission issue but have not been able to get it solved.  It started with the last upgrade to 10.8

    Back up all data.
    This procedure will unlock all your user files (not system files) and reset their ownership and access-control lists to the default. If you've set special values for those attributes on any of your files, they will be reverted. In that case, either stop here, or be prepared to recreate the settings if necessary. Do so only after verifying that those settings didn't cause the problem. If none of this is meaningful to you, you don't need to worry about it.
    Step 1
    If you have more than one user account, and the one in question is not an administrator account, then temporarily promote it to administrator status in the Users & Groups preference pane. To do that, unlock the preference pane using the credentials of an administrator, check the box marked Allow user to administer this computer, then reboot. You can demote the problem account back to standard status when this step has been completed.
    Triple-click the following line to select it. Copy the selected text to the Clipboard (command-C):
    { sudo chflags -R nouchg,nouappnd ~ $TMPDIR.. ; sudo chown -Rh $UID:staff ~ $_ ; sudo chmod -R u+rwX ~ $_ ; chmod -R -N ~ $_ ; } 2> /dev/null
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window (command-V). You'll be prompted for your login password, which won't be displayed when you type it. You may get a one-time warning not to screw up. If you don’t have a login password, you’ll need to set one before you can run the command. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator.
    The command will take a noticeable amount of time to run. Wait for a new line ending in a dollar sign (“$”) to appear, then quit Terminal.
    Step 2 (optional)
    The first step should give you usable permissions in your home folder. This step will restore special attributes set by OS X on some user folders to protect them from unintended deletion or renaming. You can skip this step if you don't consider that protection to be necessary.
    Boot into Recovery by holding down the key combination command-R at startup. Release the keys when you see a gray screen with a spinning dial.
    When the OS X Utilities screen appears, select
    Utilities ▹ Terminal
    from the menu bar. A Terminal window will open.
    In the Terminal window, type this:
    resetpassword
    That's one word, all lower case, with no spaces. Then press return. A Reset Password window will open. You’re not  going to reset a password.
    Select your boot volume ("Macintosh HD," unless you gave it a different name) if not already selected.
    Select your username from the menu labeled Select the user account if not already selected.
    Under Reset Home Directory Permissions and ACLs, click the Reset button.
    Select
     ▹ Restart
    from the menu bar.

  • I get a error message "To charge faster, use the cable and device that were provided with this phone" when charging my Samsung Galaxy note 3. I took it to a store last week and they said it has something to do with the last software update.  They tried ch

    I get a error message "To charge faster, use the cable and device that were provided with this phone" when charging my Samsung Galaxy note 3. I took it to a store last week and they said it has something to do with the last software update.  They tried charging it at the store and got the same message. I was given another phone, I still get the same error with the new phone.

    Wowuor, 
    Thank you so much for reaching to us today. I want to make sure that we get the device charging the correct way. There is no physical or liquid damage to the phone or to the power cord correct? Did this error just start to appear as of last week? Please keep us posted. 
    KevinR_VZW
    Follow us on Twitter @VZWSupport

  • I have a problem, i bought lion but when i want to install he said me i need to "download osx lion server" i'm running with the last lion beta. how to update please?

    i have a problem, i bought lion but when i want to install he said me i need to "download osx lion server" i'm running with the last lion beta. how to update please?
    ps: sorry for my english :S

    You apparently are using a version of OS X you did not purchase using your Apple ID. Although you can download Mavericks you cannot install it over your current system. You must repartition your hard drive, then reinstall the version of OS X originally installed when it came new from the factory. That would be on the installer discs that should have come with the computer. If the computer did not come with discs from the factory but OS X was pre-installed (Lion or Mountain Lion) then you can perform an Internet Recovery:
    Install Mavericks, Lion/Mountain Lion Using Internet Recovery
    Be sure you backup your files to an external drive or second internal drive because the following procedure will remove everything from the hard drive.
    Boot to the Internet Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND-OPTION- R keys until a globe appears on the screen. Wait patiently - 15-20 minutes - until the Recovery main menu appears.
    Partition and Format the hard drive:
    1. Select Disk Utility from the main menu and click on the Continue button.
    2. After DU loads select your external hard drive (this is the entry with the mfgr.'s ID and size) from the left side list. Click on the Partition tab in the DU main window.
    3. Under the Volume Scheme heading set the number of partitions from the drop down menu to one. Click on the Options button, set the partition scheme to GUID then click on the OK button. Set the format type to Mac OS Extended (Journaled.) Click on the Partition button and wait until the process has completed. Quit DU and return to the main menu.
    Reinstall Lion/Mountain Lion. Mavericks: Select Reinstall Lion/Mountain Lion, Mavericks and click on the Install button. Be sure to select the correct drive to use if you have more than one.
    Note: You will need an active Internet connection. I suggest using Ethernet if possible because it is three times faster than wireless.

  • I lost my spell check with the last update

    I lost my spell check icon with the last update from firefox. I would like to have it back.

    I don't think Firefox normally has a spell-check icon. Was it on an add-on toolbar? Do you recall Firefox saying that particular add-ons would be disabled for compatibility reasons?
    Let me guess that you used the spell check on the Google toolbar. Extensions for Firefox, such as the Google Toolbar, include a list of compatible Firefox versions. Currently, the Google Toolbar only goes up to Firefox 4. However, people have tested and it actually works on Firefox 5, so there are two workarounds:
    (1) Edit a file to revise the range of compatible versions
    (2) Install an add-on that lets you ignore the range of compatible versions
    This thread has info on both approaches: [https://support.mozilla.com/en-US/questions/837142 google toolbar does not work with firefox 5.0. why not! | Firefox Support Forum | Firefox Help].
    If it wasn't the Google Toolbar, a similar strategy still might work...

  • Was there a problem with the last update? Every time I try to watch a video on the net it goes back to the home screen

    Was there a problem with the last update? Every time I try to watch videos it goes back to the home screen

    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings      
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                 
    iOS: How to back up           
    - Restore to factory settings/new iOS device.
    If still problem, make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
    Apple Retail Store - Genius Bar          

  • Gobal Address List with the Blackberry Curve on Enterprise Plan

    How do you access the Gobal Address List with the Blackberry Curve (on Enterprise Plan) when forwarding or composing an email?  If this can be done, what is the key sequence to accomplish this task?

    The only way I know how to do it, is using the lookup option in your address book and then adding it to your address book. I've tried to do it from the email and it doesnt put the address in the to field.
    ******Debbie******

  • How do I stop Firefox from opening with the last site I was on when I closed instead of using my home page?

    whenever I open firefox after closing it down, it always opens with the last page I was on. I have the settings to point to a specific homepage and have it set to always open on the homepage, but it doesn't.

    I am having a similar problem, I'm using "Show my home page" on start-up but firefox decides to always open to the last page visited regardless. I also generally close Firefox using the red X or with alt+f4. This problem is especially annoying when the last page 'visited' is an annoying pop-up ad that wasn't been caught by the pop-up blocker.

  • Is it possible to create a variable in bex with the last work day?

    Hi Gurus
    Is it possible to create a variable in bex with the last work day?
    Actually end-user every day open queries,
        - Put in selection date day - 1 or
        - put last Friday if the day is Monday or
        - put last Thursday if the day is Monday and Friday is holiday (in a calendar for example 25 the December).
    Please do the needful. It is urgent
    Thanks in advance
    Raj

    Try this logic in a customer exit:
    DATA:  l_s_range TYPE rsr_s_rangesid.
    DATA:  X_PERIOD LIKE T009B-POPER,
               X_YEAR   LIKE T009B-BDATJ.
      CASE I_VNAM.
      WHEN 'ZPREVWORKDAY'.
        DATA: l_DayOfWeek(1) TYPE C,
              l_act_date     TYPE d,
              l_prev_date    TYPE d.
        l_act_date = sy-datum.
        CALL FUNCTION  'DATE_COMPUTE_DAY'
             EXPORTING DATE = l_act_date
             IMPORTING DAY  = l_DayOfWeek.
        CASE l_DayOfWeek.
          WHEN '1'.
            l_prev_date = l_act_date - 3.
          WHEN '2'.
            l_prev_date = l_act_date - 1.
          WHEN '3'.
            l_prev_date = l_act_date - 1.
          WHEN '4'.
            l_prev_date = l_act_date - 1.
          WHEN '5'.
            l_prev_date = l_act_date - 1.
          WHEN '6'.
            l_prev_date = l_act_date - 1.
          WHEN '7'.
            l_prev_date = l_act_date - 2.
        ENDCASE.
        l_s_range-low  = l_prev_date.
        APPEND l_s_range TO e_t_range.
    ENDCASE.
    Edited by: Tyler Blouse on Feb 13, 2008 8:28 PM

Maybe you are looking for

  • Error while filling setup tables for 2lis_13_vahdr

    Dear friends, I am getting below Error while filling setup tables for 2lis_13_vahdr. More faulty documents found than the tolerated 0000000000 Message no. M2222 Can any one guide me how to address this issue. Thanks and Regards Nithya

  • Cover Flow view in iTunes 7

    I really like the cover flow view but it seems the albums are keyed on Artist so if different tracks have different artists, they show up as multiple albums in the cover flow view. Is there any way to make it key on Album name instead? iMac 20" Core

  • PM G4 Tiger Printing queue stopped HP P1005

    Power Mac G4 Tiger and HP Laserjet P1005. System Printing Prefs reset. Followed HP advice how to reinstall driver. Still stop the queue at printing time. Jean-Louis

  • Copy Classification

    Hi. I have created a custom material class in reference to class type '001'. This class contains four characteristics. I have created material view "Classification" inserting my material class and i have indicated values in specific characteristics.

  • MBP good for hardcore multitasking??

    Ok so here is the scoop. I am a web developer who does some hardcore multitasking. Typically I have Photoshop, Dreamweaver, Safari, TextMate, Itunes, Mail, iChat, VNC and Flash open all at once. Once I get a new mac, I'll be running Parallels with Wi