Separating objects in a collection structure from its original class

This is an example of my code and will better illustrate what i'm trying to do. The problem is in the List class.
public interface ItemInterface {
  public java.util.HashMap map ;
  public void setMap(String in) ;
public abstract class AbstractItem implements ItemInterface {
  java.util.HashMap map ;
  public AbstractItem() {
    map = new java.util.HashMap();
  public void setMap(String in) {
  public java.util.HashMap getMap() {
    return map ;
public class GeneralItem extends AbstractItem {
  public void setMap(String in) {
public class List {
public void process() {
  AbstractItem item ;
  if (condition) {
    item = new GeneralItem() ;
  else if (condition) {
    item = new GeneralItem2() ; // etc, etc
  ArrayList list = new ArrayList() ;
  while (condition) {
    item.setMap(someString) ;
    list.add(item) ;
   /* here i want to reinstantiate item, but i do not want to go through the
      conditions again to determine the correct class */
}So let me try to explain the problem i'm experiencing.
With the code as is, when item changes, all prior items that were added to the list change with it. If I had the conditions in the while loop i would be able to just call new ClassThatWillBeDetermined();I'm am trying to find a way around this so that I don't need to constantly determine the class in every step of the loop.
I am familar with PHP and I understand that in PHP it is possible to do the following:
function myFunction() {
  return 5 + 2 ;
var myfunc = myFunction ;
echo myfunc() ;Is that possible to do in Java?

I'm afraid no one would understand your code and the description of the problem.
Post a small demo code that is generally compilable, runnable and could reproduce the 'problem'.
And restate your requirement more clearly, please.

Similar Messages

  • How do I prevent itunes from moving my music from its original place ie folders in an external drive when I play music from itunes. I have all my music in artist folders and separated by MPG3/MPG4 and FLAC folder within the artist folder.

    How do I prevent itunes from moving my music from its original place ie folders in an external drive when I play music from itunes. I have all my music in artist folders and separated by MPG3/MPG4 and FLAC folders within the artist folder and itunes moves the track/s whenever i try and load selected music to my ipod/iphone. I've tried to find some sort of preference to prevent this, but no joy? What am I missing?

    Try opening iTunes preferences. Then click on advanced tab. Then uncheck "Copy files to iTunes media folder when adding to library." By default, iTunes copies music to its own media folder when you use iTunes to play the music.

  • When I send or receive e-mail, the mail gets changed significantly from its' original form.....typestyle, size of letters, symbols, page layout, color, everything changes.....is there a way to fix that?.....

    When I send or receive e-mail (Thunderbird).....the mail gets changed significantly from its original form.....typestyle, font size, symbols, page layout, color.....everything changes.....is there a way to fix that so my the original form of the mail is not changed?.....

    Just to recap, this is a collection of ports I have collected over time for people who needed this information when setting up the HP ePrint app so that they could view their email from within the app.  I am certain other applications also need this information.  Although lengthy, I could not find a more comprehensive place to retrieve this information.  Feel free to post additional information, faulty information, or other related topics below as this is simply a collection of data and it would be practically impossible to test all of them. Thank you!
    Don't forgot to say thanks by giving "Kudos" if I helped solve your problem.
    When a solution is found please mark the post that solves your issue.
    Every problem has a solution!

  • Accessing private attribute of a class from its Friend Class

    Hi Experts ,
    Please help me to understand how can i access private attribute of one class from its friend class.
    I am coding in Method (DO_SAVE) of class /BOBF/CL_TRA_TRANSACTION_MGR.
    I need to access private variable ( MO_BOPF) of class /BOBF/CL_TRA_SERVICE_MGR ( Friend of /BOBF/CL_TRA_TRANSACTION_MGR ).
    Regards,
    Reny Richard

    Hi Reny,
    You should be able to access by creating object of friend class.
    Sample:
    data lo_frnd     TYPE REF TO  /BOBF/CL_TRA_SERVICE_MGR.
    data lo_compl  type REF TO /BOBF/IF_TRA_TRANS_MGR_COMPL.
       create OBJECT lo_frnd
         exporting
                   iv_bo_key = '111'
                   IO_COMPL_TRANSACTION_MANAGER = lo_compl.
    "access the private object of friend class
       clear lo_frnd->MO_BOPF.
    Note: need to provide iv_bo_key & IO_COMPL_TRANSACTION_MANAGER while creating object.
    Hope this helps you.
    Regards,
    Rama

  • How to access private attribute of a class from its Friend Class

    Hi Experts ,
    I am coding in Method (DO_SAVE) of class /BOBF/CL_TRA_TRANSACTION_MGR.
    I need to access private variable ( MO_BOPF) of class /BOBF/CL_TRA_SERVICE_MGR ( Friend of /BOBF/CL_TRA_TRANSACTION_MGR ).
    Please help me to understand how can i access private attribute of one class from its friend class.
    Regards- Abhishek

    Hi Reny,
    You should be able to access by creating object of friend class.
    Sample:
    data lo_frnd     TYPE REF TO  /BOBF/CL_TRA_SERVICE_MGR.
    data lo_compl  type REF TO /BOBF/IF_TRA_TRANS_MGR_COMPL.
       create OBJECT lo_frnd
         exporting
                   iv_bo_key = '111'
                   IO_COMPL_TRANSACTION_MANAGER = lo_compl.
    "access the private object of friend class
       clear lo_frnd->MO_BOPF.
    Note: need to provide iv_bo_key & IO_COMPL_TRANSACTION_MANAGER while creating object.
    Hope this helps you.
    Regards,
    Rama

  • After restarting my computer firefox is deleted for Windows, when i try to open firefox a message pops up saying the program has been moved from its original location and is unable to run How do I get Firefox on my computer permanently?

    After restarting my computer firefox is deleted for Windows, when i try to open firefox a message pops up saying the program has been moved from its original location and is unable to run How do I get Firefox on my computer permanently?

    I have tried everything I could to fix this, but some things require actually being on Firefox, and since I cannot get on, I cannot click on the tabs to do it. I have even totally uninstalled firefox, and that has not fixed this. I still get the same message that firefox is running and I need to close it or restart (which I have also tried dozens of times). I have removed things like Java, and that has not helped either. If I cannot even get on line in firefox, how can I fix this. I am not crazy about using internet explorer, but right now, it is my only option. I even tried to start in safe mode, and the same message box pops up!

  • Read structure from main program class??

    Hi all,
    I know that i can read the structures from the main program with (program)structure
    But now the structure is in a class or form... How can i do this?
    regards

    Hi,
    I want to use BADI WORKORDER_CONFIRM_CUST_SUBSCR and I have created my own subscreen.
    The fields are displayed in the transaction CO11N but the fields are not transfered to the table AFRU where i have created the fields...
    And the BADI is already implemented by SAP.. No multiple use possible...
    I don't know how the data from the screen can be inserted in the table AFRU without modification.
    regards

  • My Mac Air no longer charges from its original power supply?

    The Mac Air was used on the charger for the Mac Powerbook.  It no longer charges from the original Air power supply.
    How can this be corrected?

    Yes.  The Mac Air worked fine on its originial charger.  My wife needed to use it when her PowerBook died.  She plugged it into the PowerBook charger which had the same plug at it worked on the PowerBook charger.  When I tried to charger it on the original Air charger, it no longer would charge on the Air charger.

  • I have a older MacBook I upgraded memory two 3 gb from its original two but it still will not let me update from snow leopard to maverick I have plenty of available ram does anyone know why

    I believe it is running an older version of maverick it is 10.6.8 but it will not let me update any further . I added 3gb of ram to upgrade from the original 2gb it came with but still no updates are being allowed Does anyone have any idea why this is ? I am sure the criteria for the upgrade is available so I don't know why I can not up date it?

    10.6.8 is Snow Leopard.
    Run Software Update to download and install the latest updates for Snow Leopard to bring it up to 10.6.8, or download the combo update from here:
    http://support.apple.com/kb/DL1399
    Check via Software Update whether any further updates are required, particularly to iTunes (you will need the latest version in order to synch with mobile devices).
    You should now see the App Store icon in iTunes, and you now need to set up your account:
    http://support.apple.com/kb/HT4479
    You can now upgrade to Mavericks OS 10.9 for free IF you have one of the following Macs, with not less than 2GB of RAM, and at least 8GB of available space on your hard drive:
    iMac (Mid-2007 or later)
    MacBook (13-inch Aluminum, Late 2008), (13-inch, Early 2009 or later)
    MacBook Pro (13-inch, Mid-2009 or later), (15-inch, Mid/Late 2007 or later), (17-inch, Late 2007 or later)
    MacBook Air (Late 2008 or later)
    Mac Mini (Early 2009 or later)
    Mac Pro (Early 2008 or later)
    Xserve (Early 2009)
    iCloud system requirements:
    http://support.apple.com/kb/ht4759
    If you cannot run Mavericks you can purchase the code to use to download Lion from the App Store (Lion requires an Intel-based Mac with a Core 2 Duo, i3, i5, i7 or Xeon processor and 2GB of RAM, running the latest version of Snow Leopard):
    http://store.apple.com/us/product/D6106Z/A/os-x-lion
    or Mountain Lion:
    http://store.apple.com/us/product/D6377Z/A/os-x-mountain-lion

  • COM object that has been seperated from its uderlying RCW cannot be used

    What exactly does this error mean?
    I receive this error when I perform "Unload All Modules" from the sequence editor using TestStand 4.2.1.83 development system, which is part of NI Developer Suite 2010 DS1.
    It causes TestStand to crash citing that error, and then a secondary error cites corrupted memory.

    ATE_Dude_22 wrote:
    Here is a capture of my sequence editor, where I have a alert from TestStand telling me the parameter specified doesn't match the sequence parameters (specified in the vi prototype as a string not a number), but this version of TestStand allows it to execute without needing to clear the error.
    Do you think this may have anything to do with the error I am seeing?
    Probably not. Sequence calls support mismatched parameters, what happens is that the callee gets whatever is passed to it, if that's not what it's expecting, then you might get a type mismatch error if type checking is enabled, if not then it's up to the sequence what it tries to do with the parameter for what happens next.
    Most likely the bug is in one of the code modules you are calling, probably a vi or dll is not properly maintaining a reference count somewhere or is corrupting memory and only indirectly causing the error. If most of your code is in labview, one thing to look out for is incorrectly specified calls to dlls from LabVIEW. If a call to a dll is incorrectly specified, either from LabVIEW or TestStand that can very easily lead to memory corruption and random errors later on in the code.
    I'd recommend trying to either debug and see where it's failing, if it's always failing in the same place. Or try to eliminate possibilities and reduce the called code to the minimum code required to reproduce the problem and then look for bugs in that code (paying special attention to the possibility of incorrectly specified dll calls and/or perhaps incorrectly maintained reference counts on COM objects).
    Another idea, to see if the problem is memory corruption caused by a vi, is to run all of your labview vis using the development environment (labview adapter setting), if so, any memory corruption would be in the labview process and not the main teststand process and should not bring down teststand.
    -Doug

  • Importing to iTunes, does it move the file or play from its original location?

    Say I import music files from an external HD and place them on my desktop. Once I import them to itunes to play them does it make a copy and move the file to iTunes folder? That being said, after importing do I have duplicates of each file? Can I go ahead and delete them off the desktop? Does iPhoto work this way as well?

    Hello ,
    For iTunes :
    Created a copy of the files in iTunes folder .
    But before you delete the files from the desktop ,
    I suggest you check .
    Finder > music > iTunes > iTunes Media
    For iPhoto :
    I do not use this software so I do not know but
    I can assume it's the same thing as iTunes .

  • How to delete the committed row from a table from its VOImpl class ??

    I am new to ADF and I have problem to solve. To perform roll back I am using fetching key before roll back and setting it after undo operation, so that I can stay back in the currently selected row. But in my case I am using application model commit for one LOV attribute selection in the row. So when ever I am performing roll back operation after inserting a row, the values other than this committed LOV attribute gets roll backed, but I need remove the entire row from table. Does there any option to remove a row based on the attribute values of a row from VO's row implementation or from bean class in a performance optimized way ?
    Thanks in advance..........

    http://java.sun.com/javase/6/docs/api/javax/swing/table/DefaultTableModel.html#removeRow(int)
    Why did you mark it answered but gave no dukes to finalight? That's not how it works.
    You should mark his answer as correct and give him at least one duke, for the effort!

  • Will Microsoft office install on a diffrent system from its original installed system.

    Hey helpers, I've installed Microsoft office 2011 (1 user) as soon as I brought my iMac( OS X was snow leopard 10.6) but then I installed mountain lion but accidentally installed a virus and my virus scanner didn't detect it so I had to ( my only choice) delete all my files, now I'm reinstalling mountain lion but was worried about that it would not install because the Microsoft office would not recognise it is the same exact mac except for the OS. Do I have to buy a new Microsoft office again?......Or can I just reinstalled it, I know some users will think why don't  I just try it out after it installed but I'm having finance issues and I need the Microsoft off really bad, Please help!

    No,  you don't have to buy it again. Install it, enter your license code.
    BTW, there are no OS X viruses. See:
    Helpful Links Regarding Virus Protection
    An excellent link to read is Tom Reed's Mac Malware Guide.
    Also, visit The XLab FAQs and read the FAQ on malware.
    For general anti-virus protection I recommend using ClamXav.

  • "COM object that has been separated from its underlying RCW cannot be used.

    I am constantly getting the following error when closing my app if we viewed/printed a report.  What do I need to do to correct this error?  For the following error, I opened my app, viewed a report on the screen using the 'CrystalReportViewer', closed the report viewer window, closed my app.  When closing the app, the following error occurs.
    CR version: 11.5.3300.0
    VB.NET v2.
    System.Runtime.InteropServices.InvalidComObjectException was unhandled
      Message="COM object that has been separated from its underlying RCW cannot be used."
      Source="mscorlib"
      StackTrace:
           at System.Runtime.InteropServices.UCOMIConnectionPoint.Unadvise(Int32 dwCookie)
           at CrystalDecisions.ReportAppServer.%. {(_ISCDClientDocumentEvents_OnClosedEventHandler  u)
           at CrystalDecisions.ReportAppServer.%.remove_OnClosed(_ISCDClientDocumentEvents_OnClosedEventHandler value)
           at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.DisconnectEventRelay()
           at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.  (Boolean  \b, Boolean       )
           at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Dispose(Boolean bDisposeManaged)
           at System.ComponentModel.Component.Dispose()
           at CrystalDecisions.CrystalReports.Engine.ReportDocument.  (Boolean      :)
           at CrystalDecisions.CrystalReports.Engine.ReportDocument.  (Boolean      ;)
           at CrystalDecisions.CrystalReports.Engine.ReportDocument.Close()
           at CrystalDecisions.CrystalReports.Engine.ReportDocument.
        (Object      >, EventArgs      ?)

    Hello,
    First thing is to install Service Pack 6 which you can get from the download page by clicking on BusinessObjests tab above and then downloads on the left...
    When you close your viewer be sure to add/have Youreportobject.close and Youreportobject.Dispose. Adding a GC.Collect may help also.
    Thank you
    Don

  • From which version JVM starts supporting Object bindings in collections.

    from which version JVM starts supporting Object bindings in collections.
    private ArrayList<String> arr = new ArrayList();
    this will bind String objects to arr, nothing else will be stored.
    which version of JVM should I confirm, before using this feature!!!
    please comment.

    thanks MLRon!!!
    They are called "generics", not "bindings". In any case, you need Java 1.5 (also known as Java 5.0).Can generics be used anywhere, or only with collections.
    for eg:-
    public class Abc {
    public Abc(Object obj) {
    if(obj instanceOf String)
    doSomething;
    if(Obj instanceOf Xyz)
    doSomething;
    while creating Abc instance can I use this:-
    Abc<String> abc = new Abc("abc");
    and could we also do this:-
    Abc<String[]> abc = new Abc(new String[5]);
    and what exception does generics generate, if we don't obey them.
    for eg:-
    Abc<String> abc = null;
    abc=new Abc(new Xyz);
    and should generics code be kept in try catch block!!!
    please guide me!!!

Maybe you are looking for

  • Can I use time capsule as an external HDD to free up memory on my comuter along with the time machine backups?

    I currently am considering a WD My Book Live Home Network Drive for 189.00 but would consider a time capule if it will allow me to rid my iMac of all the pictures and videos to free up my memory and store it on the time capsule for  easy access on my

  • Image Processor resolution

    I've done a bit of searching but this is what I'm trying to do: I have 9 folders (unit 01, 02, etc.) with CS3 .eps files in them. I want to rasterize these files in PS CS3. I would like to use the tools>photoshop>image processor from Bridge to do so.

  • CRM_ORDER_MAINTAIN for Appointment Item Level

    Hi All, I am currently trying to insert a date into DATE TYPE(APPT_TYPE) in Item Level. There are no errors in the code but the transaction is not updated.The dates are not shown in that particular document. Can somebody help me out ? Thanx a lot...

  • OraOps.dll differences on 64-bit and 32-bit

    Just wanted to post this here, maybe it'll save someone a lot of headaches. We have a 64-bit Intel Xeon server running W2K3. We developed on a 32-bit Server using XE Database and XE Client. Then, we install the 64-bit oracle client on the prod. serve

  • Change link color

    I want to change the color of links I have visited in safari/google because I cannot see the difference in the colors very well.  Currently unvisited links are a light blue and visted links are a light purple.  I need an easy way to do this please? T