Best Way to store references to other objects

Hi there,
I want to design a class, that has several references to other instances. What is the best way to store such references within the class? As a vector? As a Hash-Table?
What I need are:
-get a certain element in this data-structure fast (let's say the fifth)
-be able to list all elements referenced
-delete a certain element (e.g. 5th one out of 10)
What I do not necissarily need is:
-to be able to search if a certain object is referenced by this one
What do you propose?
Any ideas?
Thx
Karlheinz Toni

Any thoughts on hashtables etc?
I used them in an application where i needed to get
objects quickly. It allowed me to get the objects
based on a criteria instead of by the object itself.
It was really useful for me.Use HashMap instead of Hashtable. HashMap would also work but you can't get element 5 unless you use the element number as a key. If you do use the element number as the key, it's kind of like using a List except it won't renumber itself, which you may or may not want. For example, if you remove element 5 from a List element 6 (if it exists) becomes element 5. If you remove key 5 from the HashMap you just don't have an element 5 anymore i.e. the map will return null for get(new Integer(5));

Similar Messages

  • Best way to store TenantID in Azure

    I'm developing a multi tenant application
    I am using ASP.NET MVC and Asp.net Identity for authentication
    My client can have more than one company and you can change, user have multiple company
    I wonder what is the best way to store the TenantID in azure
    Claims?
    I'm Claims my value is:
    Type = "TenantId"
    Value = is Guid ( difficult or impossible to be guessed by changing the value of the cookie )
    Cache?
    Session ["TenatId"]?
    Router? {tenantid}}/controller/action

    Hi
    When you get a Graph Token from AAD, it has an Issuer claim in the Claims that has the TenantId in it, so you don't need to store the TenantId in a different claim:
    Sample issuer claim:<Issuer>https://sts.windows.net/cbb1a5ac-f33b-45fa-9bf5-f37db0fed422/</Issuer>For your reference of all available claims in AAD token take a look at here:https://msdn.microsoft.com/en-us/library/azure/dn195587.aspx#BKMK_TokenClaims
    Regards
    Aram

  • Best way to store many images at once is?

    I am dealing with a number of image files at once (10 - 100) that are small in size (5-300kb) and I want to be able to retrieve them quickly after I save them to disk. I want to store them all in an array and save the array. What is the best way to store them as so I can save space on my disk and load them back in quickly when I need them. I tried using an array of ints and that is slow to load and takes a lot of space on disk.
    Thanks

    maybe this is what you want, from javadocs,
    public class MediaTracker
    extends Object
    implements Serializable
    The MediaTracker class is a utility class to track the status of a number of media objects. Media objects could include
    audio clips as well as images, though currently only images are supported.
    To use a media tracker, create an instance of MediaTracker and call its addImage method for each image to be
    tracked. In addition, each image can be assigned a unique identifier. This identifier controls the priority order in which
    the images are fetched. It can also be used to identify unique subsets of the images that can be waited on independently.
    Images with a lower ID are loaded in preference to those with a higher ID number.
    Here is an example:

  • What is the best way to store and search 2D data

    Hi,
    There is a set of data (~10k records ) in 2D dimension.
    like this :
    Col 1, Col 2, Col3....
    What is the best way to store and search those records ?
    Thanks in advance
    Wilson

    Hi,
    Either userObjet[][] if you know how much data you have, and the data size is fixed, or use a list of lists. E.g. A Vector of Vectors (some will probably say that you should use an ArrayList instead, and that could be the case, but it sounds like you would want to display the data later on, and a DefaultTableModel (for JTables) uses a Vector as data holder).
    Kaj

  • What's the best way to store my info externally

    I have recently bought my first Macbook Pro 13" with 2.4 Ghz. I am currently using it for my own business and do tend to get a lot of files together. I went to look at "About this Mac" and have already got 369 Gb used up in storage... I have no idea how I have done that as I have hardly downloaded any apps on this computer besides the ones that were on here. I did download Vware Fusion 4 as I have a reservation system which I used to run on my pc and need to have this on here too so perhaps that software takes a lot of space.
    Could anyone advise on which is the best way to store my info externally, will any external harddrive do, or do you need a special one for Apple or Macbook pro. I am just asking as I have no idea and prefer to buy the right one straight away.
    Any help would be much appreciated !
    Thanks, Sara***

    Sara,
    The most reliable method is to use an external hard drive.  Some are better than others, but most will work.
    For the least amount of setup pain, I prefer to deal with the Mac specialists at OWC, http://www.macsales.com as they stand behind their products with great warranty and support.  I have one of their Mercury Elite Pro 2 TB drives that has multiple interface capability so you can get a fast interface for data transfer.
    Take a look at what they offer and see what fits your needs.  If you have more questions about doing thin, just ask on here.
    Ralph

  • Best way to store data from a plot on hard drive

    I have a DAQ set-up that will be on 24/7 for several days, and the whole time it's streaming data to an XY-Graph with a limited buffer.  My question is, what's the best way to store my plot data in such a way that I can empty out my plot every few hours but if I want to pull up data from a few hours ago I would just have an option on my initial VI to view any old saved plot data.
    Basically, I'm trying to not overload my RAM with all my plot data so I'd like to save it to the hard drive while my VI is running, and only display, for example the last 8 hours worth of data... I've been looking at TDMS, but I'm not sure if that's the right solution.  
    much thanks!

    Hi,
    You could save your data using TDMS as well as ASCII to simply load it in another application later.
    Attached VI shows you how to save your data to a File after a certain amount of iterations, you can combine this then with your code and a timestamp.
    Christian
    Attachments:
    Save to new file every N samples.vi ‏20 KB

  • What is the best way to implement a cluster-wide object ID generator?

    What is the best way to implement a cluster-wide object ID generator?

    What is the best way to implement a cluster-wide
    object ID generator?Always use 3 because it is prime.
    Alternatively more information about the system and the needs of the system might prompt alternative ideas some of which are likely to be better than others for your particular implementation and system constraints.

  • Best way to store documents and images in a web application

    All,
    Which is the best way to store the documents, is it Oracle DB or file system or Virtual Directory Mapping in weblogic.
    We are working on a Internet based application into CRM domain, there is a requirement where user can upload and download the documents (.pdf, .xls, .doc etc). Right now we are storing images in the DB. Is it advisable to store all the docs in database and will it scale up in future.
    PS: There is no scope for using content server because of business constraints.
    Please let me know, thanks in advance.
    Regards
    Girish

    Best way to store depends entirely on requirements.
    Why store it in the database when it for example is purely static images (e.g. used as part of the web GUI)? Instead that can be served up directly by a web server - which is specifically designed for this.
    If it is more than just an image, but include tags (non spatial data attributes), requires transaction control (e.g. updating an old passport/id photo with a newer one), auditing, filtering/searching and ordering, requires backup, needs security and access controls, and so on - than that is most definitely a database function.
    So the issue is not what the binary file is or contains - an image or pdf or something else. It depends entirely on how it is to be used and what the business requirements are in this respect.

  • What's the best way to store old FCP projects & media?

    Hey
    I've started to accumulate more and more video content of client projects, but I don't want to delete it in case they come back a year later looking for an update on the video product I made them.
    So, what's he best way to store FCP projects and video files?
    I thought maybe a BluRay burner might do the trick.
    Any suggestions?
    Sam

    Since you're using RAW files you might peruse the DAM Forum to learn about possible other DAM (digital asset management) software and workflows. There is a wealth of information at that site.
    I useMedia Expression for my primary DAM application and iPhoto for special projects like books, calendars, etc.

  • Can you suggest a best way to store and read arabic from oracle database?

    Hi ,
    can you suggest a best way to store and read arabic from oracle database?
    My oracle database is Oracle Database 10g Release 10.1.0.5.0 - 64bit Production on unix HP-UX ia64.
    NLS_NCHAR_CHARACTERSET AL16UTF16
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    NLS_CHARACTERSET WE8ISO8859P1
    I have presently stored the data in nvarchar2 field. But i am not able to display it correctly.

    Using the national characterset should work but there are other factors that you have to consider when working with NCHAR/NVARCHAR2/NCLOB.
    If possible, changing the characterset is usually the best solution if it's a possiblity for you.
    For more info:
    Dear Gurus: Can u pls explain the difference between VARCHAR2 & NVARCHAR2??

  • Best way to store big amount of data

    Hi, i need to store a big amount of data, written in a txt its size is almost 12 mg, anyway it depends on the computer it runs, beacause what i want to store is all the shared files in a computer.
    Which is the best way to store it? Array string? textfile? List? I don�t need the data after the app close.
    Thanks

    Well, then which is the best solution? LinkedList or
    Tree? i only need to store the full path.
    What i didn�t say, my fail, is that i need to search
    for a file name once i have stored them...For searching, LinkedList will be very slow if it's very large. I think the same is true of javax.swing .tree.DefaultTreeModel, which is the JDK's only tree implementation. I don't know what Jakarta-collections has - it's possible they have a tree that offers fast searching. If you want to stick to the standard Java libraries, you'll want a Set for fast searching. TreeSet keeps the entries in sorted order. If you also need to display them as a tree, you can keep them in both a Set and a tree. If you don't have enough memory to do that, then displaying the whole tree isn't going to be useful to the user anyway, so rethink your goal.

  • Best way to store constants

    I'm working on a set of drivers that call functions from a DLL provided by the instrument manufacturer.  They have an extremely detailed manual, which has been very helpful.  When they describe the functions (and the different values I can pass), they use named constants, and then at the end they define the value of each constant.
    This sort of thing works great in a text-based programming language: just assign the appropriate values to the constants at the beginning and you're ready to go.  But what's the best way to store these constants in LabVIEW?
    My initial approach was to use (strictly typedef'd) text rings (or occasionally enums): the constant name was the text string, and the numeric value was the value of that string.  The problem is that they occasionally have multiple constants with the same numeric value, and LabVIEW doesn't let you have duplicate values in a text ring.
    The thing I really like about using text rings is that this way, I have all of the values at hand to use in a control or a constant; I just plop down the appropriate text ring and select the constant I want.  It's also easy to keep consistent across all of the VIs in the project, since it's a typedef.
    But...since it looks like this won't work, at least not completely, what's the best alternative?  Enums wired to case structures that pass out the appropriate value?  Dual arrays, one with the constant name and the other with the value?  Something else?  The downside is that all of the above need some sort of wrapper VI, but I can't think of a way around that.  What would you do? 

    > It's also easy to keep consistent across all of the VIs in the project, since it's a typedef.
    Unlike an enum, the ring's data isn't really part of the typedef. If you drop a (strict typedef) ring constant on the diagram, the data is only up-to-date as of when the constant is dropped on the diagram; it isn't dynamically updated to reflect changes in the data of the underlying typedef. (And of course anything goes with non-strictly typedef rings, where you can set the strings at runtime.)
    As for the best solution, I don't know. Despite the above problems with rings I have still used them for this purpose since usually the definitions don't change with time. Your idea of using an typedef enum + case statement in a VI seems like the safest approach for constants that can have duplicate or nonconsecutive values.
    Message Edited by Rob Calhoun on 08-25-2009 02:52 PM
    Message Edited by Rob Calhoun on 08-25-2009 02:54 PM

  • Best way to store a lot of image files??

    I am working on a new project which involve user upload image to server and then do searching and view image. there will be a lot of image files. image will be displayed in web page as thumbnails, so there may be resized pic stored in server or resize on the fly.
    What is the best way to store image like this? as files in file system? database? etc...?
    Thank you very much

    Since seraching is invloved use a database. A file system is not good place to search in.
    Using a database will allow you to store additional data as well such as comments about the images or the ratings given by the users.
    Of course you will have to develop a propper table structure for this.
    Also do not generate thumbnails all the time instead cache them once they are created. Atleast the thumbnails of the images that are displayed often.
    Also store the last updted dates with the images so you can loow the images to be cached by the clients or the proxy server. That will reduce repatitive requests for the same image from same client.

  • What is the best way to store a battery?

    Hi,
    I have an extra MBP battery. What is the best way to store this extra battery? Should I store it when it is fully charged? or Should I store it when it is half full? Is it necessary to use that batter once in a while?
    Thank you beforehand.
    Bob

    http://www.apple.com/batteries/notebooks.html
    If you're storing it for a long time, put it away when it's about half full. If you have a couple of batteries for your MacBook, I'd recommend swapping batteries once a month or so to extend the life of both batteries.

  • Best way to sync and view other videos formats

    hi all,
    me and my wife both have iphones and  have recenly bought a ipad and apple tv. I am getting a bit frustrated as i cant work out the best way to store and easily view my old pics and video files.
    the shops salesman convinced me to by knowhow cloud which seemed brilliant but it wont back up al photos so ill go back to the shops. its just app on the phone that shows all pics stored on my windows pc
    i also want to know what way is best to store and view some .mod files or moi files. I have air video which works great for divx files but not the ones i want ex my video camera
    any help greatly received
    main reason for the ipad is to create a central hub for viewing pics and videos on and streaming to tv in background when we have parties or just remenicising
    alistair

    Unfortunately, the playback of non-iOS-native video formats (everything except mov / mp4 / m4v) is horrible through Apple TV and it, because of the inherent speed restrictions of Wi-Fi, can't be helped other than:
    - pre-converting your video files to mov / mp4 / m4v before playing them. (THis is the best solution.) For this, you will want to use the absolutely best and fastest video converter, the free(!!!) HandBrake. Don't ever think of paying any money for any video converter - most other titles are way inferior to HandBrake. (See http://www.iphonelife.com/blog/87/benchmark-excellent-multimedia-converter-handb rake-vs-commercial-apps for more info on this q.)
    - using a VGA or HDMI adapter and connecting your TV directly to the iPad.
    In the thread at https://discussions.apple.com/message/18697551?ac_cid=sa123456#18697551 , we've also discussed this problem (AirPlay vs. cabled playback)

Maybe you are looking for

  • Problem in RG23C -On Hold account- Credit Transfer

    Hi, We are Imported One Capital Goods from Switzerland in 2006.For Imported Capital Goods as per legal requirement BED, AED and ECS to be avail 50% in current year and Balance 50% can avail in subsequent year or next year. Based on that we are availe

  • Can't access movies in iTunes Store after iOS 7 upgrade

    I cannot access, click, scroll, or download movies at the iTunes stores after downloading iOS 7. It's the first issue I've encountered. Sort of weird that I can access music but the movies section is inaccessible. I can see all the titles, but can't

  • Coding for the flash player

    Is there anyone out there that would like to help me code the flash jukebox that is in the samples. If you visit the link at the bottom of this post you will see what i need help with. I would like to get my music inside the jukebox along with some a

  • Does anyone have Windows and cache on an SSD?

    A variation/simplification of my previous post. Has anyone managed to use an SSD with both an SRT cache partition and a Windows operating system partition on a Z68 board? If so, please tell me which board/ BIOS version/ RAID ROM versions (CTRL-I)/ IR

  • Snow Leopard and G4 iBook

    Is it a good idea to go from 10.4.11 to Snow Leopard? I have 1 gig of ram...and worry that it may screw things more than help? New computer will be in works within 6 months....?? My wife just bought a new one so I have the OS disc here... thanks. Bob