Is there a class for this?
I'm trying to store a collection of data in which certain elements are removed after they've been present for a certain period of time. Some items live longer than others. What I want is to retrieve these items in roughly the same order every time.
Let's say that I start with 1 2 3 4 5 6 7 8 9 10. Then 4 times out, and 11 comes in. I want retrieve them as 1 2 3 11 5 6 7 8 9 10.
I could write my own class for this, but I'd rather not have to if something like this exists. Any help would be greatly apreciated.
Let's examine your problem carefully
You want to have some data structure that behaves like a list, but insertion order is not at a fixed position, but preferrably at "erased" positions (like a disk using the FAT file system).
java.util.ArrayList will not do the job nicely , nor java.util.LinkedList - you will need to maintain a lot of pointers.
Probably you will have to write a class that borrows the idea from the FAT file system - you have an (almost) fixed-size array representing the data. If you want to remove an item, simply set its reference to "null" in the array.
If you want to insert a new item, you need to find the first (or last - depends on your needs and if it is better to move less or more items on screen) empty slot.
If your data requires more elements than your array size, you must copy the array into a bigger array, and release the older array.
Similar Messages
-
My friend switched his phone number from an iPhone to a Blackberry. My phone still wants to use iMessage to send him a text and won't let me send it as a text unless I turn off iMessage on my phone. Is there a fix for this?
jengrz wrote:
My friend switched his phone number from an iPhone to a Blackberry. My phone still wants to use iMessage to send him a text and won't let me send it as a text unless I turn off iMessage on my phone. Is there a fix for this?
TechCrunch posted a solution today that applies to this problem, I think.
Go to: https://supportprofile.apple.com/MySupportProfile.do
Click your old iPhone and "unregister" it.
More info here:
http://m.techcrunch.com/2012/01/05/i...d=tc_home_art& -
My ipod nano 6th gen fell out of my pocket and the screen cracked badly, is there any coverage for this under warranty? I just bought it a month ago. If not what are the options for getting it fixed? It is pretty frustrating, it fell from about 3 feet out of my pocket and now looks like it was beaten by a hammer.
Debbie:
deborahfromwindsor wrote:
he advises restarting by inserting the OSX disc and pressing down the C button to reboot from there then selecting disk utility, hard disk and repair.... Does he mean me to hold down the C key on the alpha keyboard or the ctrl key?
Should I just ask for my money back??? If it is a simple repair do I just literally push the disc in, push the power button and hold down the C button?
That's where I would begin, too, with
Repair Disk
Insert Installer disk and Restart, holding down the "C" key until grey Apple appears.
Go to Installer menu (Panther and earlier) or Utilities menu (Tiger) and launch Disk Utility.
Select your HDD (manufacturer ID) in the left panel.
Select First Aid in the Main panel.
(Check S.M.A.R.TStatus of HDD at the bottom of right panel, and report if it saysanything but Verified)
Click Repair Disk on the bottom right.
If DU reports disk does not need repairs quit DU and restart.
If DU reports errors Repair again and again until DU reports disk is repaired.
If DU reports errors it cannot repair you will need touse autility like TechTool Pro,Drive Geniusor DiskWarrior
First we need to determine if the issue you are experiencing with the computer is software or hardware based. Once we have gotten things sorted out there should be time enough to make you decision about keeping or returning it.
cornelius -
Since upgrading my iPhone 4 to the new ios6 software I can no longer access itunes through the itunes app. I there a fix for this yet?
Scalesy05 wrote:
I there a fix for this yet?
Why would there be a fix? YOU are having the problem. I'm not, no one I know is having the problem. No fix is needed.
Basic troubleshooting steps clearly outlined in the User Guide are restart, reset, restore from backup, restore as new. Have you been through any, if not all of these troubleshooting steps yet? -
I am trying to connect a 24" cinema display with mini display port cable to a 24" imac with a displayport - is there a cable for this as these two connections are two different sizes
Hi Gilly,
I have no proof, but I think it will not work with an adapter, only Mini Display Port or Thunderbolt. -
my iphone 5s with lightning to 30 pin adapter doesn't work in my audi A6 to play music, only to charge the phone. is there a fix for this?
Is the adapter the genuine Apple product or a copy
-
Is there a way to print from ipad 4 to a non AirPrint printer?
I have a Canon Pixma MP 620 wifi which works fine with my PC but I don't want to buy a new printer.
Is there an app for this or adaptors which could work?
Thank, RicPrintopia is another option but be aware that since these solutions effectively act as a print server and AirPrint receiver, they require a computer to be running on the same WiFi network.
Canon also has a couple of apps in the App Store that might facilitate this on non-AirPrint printers. Check out...
Canon Easy-PhotoPrint
Canon Mobile Printing
PIXMA Printing Solutions -
Title says it all. I just upgraded to Mac OS X Lion, and can no longer use a finger swipe, whether one or 2 fingered, to move backwards an forwards between pages. I can still do so in Safari, but not in Firefox 5.01, my preferred browser, any longer. Doesn't matter if I try using one, two or more fingers
Is there a fix for this? Thank you.If you download this program http://blog.boastr.net/?page_id=1722 (better touch tool), you can make your own swipe gestures.
However, I have been able to three-finger swipe forward and back on webpages by going to ''system preferences'' > ''trackpad settings'' > ''more gestures''
and checking the box at ''"swipe between pages"'' and selecting ''swipe left/right with 3 fingers'' -
I use floating time zone with all of my iCal entries. But then the times of the entries do not print when printing month view. Is there a fix for this?
Sorry to have repeated this question as if I were answering it. Just a mistake. I'm just now learning how to use this site.
-
Hi, I've been playing Smurf's village for a year now and just last week, i tried to get into the app but it keeps rejecting and goes back to the main page. Is there any reason for this? I've been updating the app everytime and now it's not letting me in. Pls advise. Tq
Reset the device, restart the device, try downloading any other app.
All of these are basic steps that could have been found by a simple search of the forums as a resolution for the issue. -
When I try and type somethink on my Phone page of the iPhone it seems to have hund, yet I am able to send SMSSes, eMails, etc.? Is there a reason for this?
What's the URL of the page?
In the mean time clear the cache and reload the page. -
I recently upgraded the software on my iPad 2 to iOS8.02. Since upgrading the iPad is running slower and choppier, with several apps no longer working. In addition, it keeps knocking me off my cellular data and showing no service. Is there any fix for this, or can I downgrade the iOS back to 7?
I'm sorry, but Apple does not provide a downgrade path for iOS. Because downgrading is unsupported by Apple we cannot discuss it on these forums.
You may leave comments at Apple Feedback. -
After upgrading to ios6 my iphone will not open .xls files in emails with the default viewer. Is there a fix for this? The same emailed .xls files still open on my ipad using ios5 while viewing email like they did on my iphone prior to upgrading. I have no special software like numbers or anything else installed on either device. Just using the default viewer provided by apple for viewing email.
The attachment is an .xls excel 97-2003 spreadsheet. I viewed the file in the email and did not edit it with any software. I can forward the file to anyone that is may want to check it out to see if they can help me. I was wondering if there was some way of forcing another ios6 install on my phone and maybe that would solve it.
Is there anyone out there that is viewing .xls files in email using ios6 w/o any other software installed like numbers or any other add ons? I am not upgrading my ipad from ios5 to ios6 so I can still continue to view the emails on my ipad. Is there an email viewer .xls plug-in that will be availablle in the next ios6 update? -
I have just updated to Lion and now my folders no longer show number of items on the bottom. Is there a fix for this? I allways found that handy. Now I have to click on an icon on the top, This is a backward step if that is now the only way to see the number of items. Am I missing something obvious?
Parrotcat wrote:
I have just updated to Lion and now my folders no longer show number of items on the bottom...
In the good old days of Snow Leopard, an open Finder folder had a border along the bottom of the window which could show the number of items in that window and the total available space on the hard disk or partition that folder resides on. That bottom border is gone in Lion and those two bits of information are gone with it. Is that what you're talking about? If so, I'd like to learn how to get it back too and "Show Item Info" is not the way. -
After updating to OSX 10.7.3, my search (spotlight) no longer works. Is there a fix for this?
Have you tried going to System Preferences > Spotlight > Privacy and dragging your hard drive into the box then drag it back. That will trigger a re-index.
Maybe you are looking for
-
C# Script to open and read an Excel spreadsheet with multiple worksheets
Can someone provide me the C# syntax and Edit Script to open an Excel spreadsheet with multiple worksheets and then using the data to create and output a .csv file? The multiple worksheets contain different data elements that I'll need to parse out a
-
Has anyone updated to 10.5.3 yet?
Have you done it? Frankly, I'm terrified. I've had so much trouble getting the darn thing to work that i don't want to mess it up! I rely on that thing for ichat, radius auth, dns, and a couple other things. though, i never did get ical server workin
-
Cannot install drivers in win 7 32 bits using bootcamp 4 or 5
I posted this question yesterday. anyway, I have a imac midi 2011, 21,5 inches using OS x mountain lion 10.8.2. Manuals say I have to install bootcamp 4, because I install windows 7 profesional 32 bits. Al follow all this instalation requirements, bu
-
Configuring mod_wl_ohs for OHS to weblogic
Hello, I'm trying to configure SSL between OHS and a weblogic application server. I've been through various docs and threads, but cannot seem to find the answer to the problem. I can pull up a ssl page on the app server itself, and see that it's secu
-
In my custom funstion module some where the code is written like below for marc table read CALL FUNCTION 'MARC_SINGLE_READ' EXPORTING matnr = matnr werks = werks IMPORTING wmarc = lv_marc What I nee