Is it a better practice to create an ArrayList at class level?

Hello forum members,
Of late one of my collegue suggested me to declare an ArrayList at class level and clearing the data for each method call as garbage collection is not guaranted in java and we may end-up with large pool of ArrayList objects on subsequent method calls!!!
FYI :There was a need of an ArrayList object for a single method only.

Bad suggestion. Variables should be declared in the scope in which they are used.
Also bad reasoning. It needn't bother the programmer that garbage collection isn't guaranteed to run whenever a variable goes out of scope. It's sufficient that it is guaranteed to run before the program throws a OutOfMemoryError.
That said, parts of the JDK instantiate an object as a class field and set (and subsequently access) its attributes in various methods to reduce the overhead of object creation for enhancing performance. Much of this is legacy code from the days of slower computers and less efficient JVMs and probably wouldn't be written the same way today.
db

Similar Messages

  • Best practice to create multi tier (atleast 3 level) table

    What is the best practice to create multi tier (minimum 3 levels) of table?. Could any one provide a sample structure?.
    Thanks.

    Can u b more specific as to what you are trying to do. What u mean by 3 level table?

  • Want to create sequence at class level  row_number , DENSE_RANK() , rank(),

    Dear All,
    I want to create serial no at class level please check my query , i have already try , row_number , DENSE_RANK() , rank(), it shows 1
    Please guie .
    Regards
    SELECT
    distinct
    cla.R_Description,
    cla.N_Description,
    period.period_name,
    cla.BRANCH,
    cla.CLASS_NAME,
    cla.CLASS_NAME CLASS_NAME_SEQ,
    DENSE_RANK() OVER (partition by cla.R_Description order by cla.CLASS_NAME) CLASS_NAME_desk,
    RANK() OVER (partition by cla.CLASS_NAME order by cla.CLASS_NAME) CLASS_NAME_rank,
    st.ACCOUNT_NUMBER,
    st.PARTY_NAME,
    decode(ASCII(substr(site.attribute13,length(site.attribute13),length(site.attribute13)-1)),13,
    substr(site.attribute13,1,length(site.attribute13)-1),site.attribute13) FATHER,
    pay.amount_due_original,
    trx.trx_number challan_no,
    ST.SECTION,
    pay.amount_due_remaining,
    TO_NUMBER(trx.attribute3) Concession,
    ARREAR.DUE_AMOUNT
    FROM
    RA_CUSTOMER_TRX_ALL TRX,
    student_city_school_all st,
    class_v_table cla,
    bill_period period,
    ar_payment_schedules_all pay,
    HZ_CUST_SITE_USES_ALL SITE_USE,
    HZ_CUST_ACCT_SITES_ALL SITE,
    --branch_network_region_link br,
    ( SELECT BILL_TO_CUSTOMER_ID,SUM(DUE_AMOUNT) DUE_AMOUNT FROM ARREARS_STUDENT WHERE PERIOD_START_DATE < nvl(:P_START_DATE,PERIOD_START_DATE)
    --AND
    -- ORG_ID=NVL( :P_ORG_ID , ORG_ID )
    GROUP BY BILL_TO_CUSTOMER_ID
    ) ARREAR
    WHERE TRX.ATTRIBUTE_CATEGORY='Periodic Billing'
    AND trx.attribute2=cla.Fee_Structure_Id
    AND trx.bill_to_customer_id=st.CUST_ACCOUNT_ID
    AND TRX.BILL_TO_SITE_USE_ID=SITE_USE.SITE_USE_ID
    AND SITE_USE.CUST_ACCT_SITE_ID=SITE.CUST_ACCT_SITE_ID
    AND TRX.BILL_TO_CUSTOMER_ID=ARREAR.BILL_TO_CUSTOMER_ID(+)
    AND trx.org_id=nvl(:p_org_id,trx.org_id)
    AND trx.attribute1=period.period_id
    -- AND period.period_id=:P_PERIOD_ID
    AND trx.customer_trx_id=pay.customer_trx_id
    -- AND cla.branch=nvl(:P_BRANCH,cla.branch)
    -- AND CLA.CLASS_NAME=NVL(:P_CLASS,CLA.CLASS_NAME)
    -- AND cla.N_Description LIKE '%KAPCO%'
    -- and (cla.CLASS_NAME like '%kapco%' or cla.CLASS_NAME like '%kapco%' )
    --&P_WHERE
    ORDER BY CLA.CLASS_NAME, ST.SECTION,
    ST.ACCOUNT_NUMBER

    Please have the decency to format your code and put it in between delimiters.
    Also provide create table statements and some test data along with some output that your expecting to see.
    Finally you have had 18 posts and 15 are unresolved. Could you please take the time to mark those as answered
    or we will assume that it is a waste of time helping you as our answers aren't helpful to you.
    All the above is explained clearly in the FAQ
    SQL and PL/SQL FAQ
    Edited by: Paul Horth on 05-Mar-2012 23:55                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Looking for best practices when creating DNS reverse zones for DHCP

    Hello,
    We are migrating from ISC DHCP to Microsoft DHCP. We would like the DHCP server to automatically update DNS A and PTR records for computers when they get an IP. The question is, what is the best practice for creating the reverse look up zones in DNS? Here
    is an example:
    10.0.1.0/23
    This would give out IPs from 10.0.1.1-10.0.2.254. So with this in mind, do we then create the following reverse DNS zones?:
    1.0.10.in-addr.arpa AND 2.0.10.in-addr.arpa
    OR do we only create:
    0.10.in-addr.arpa And both 10.0.1 and 10.0.2 addresses will get stuffed into those zones.
    Or is there an even better way that I haven't thought about? Thanks in advance.

    Hi,
    Base on your description, creating two reverse DNS zones 1.0.10.in-addr.arpa and 2.0.10.in-addr.arpa, or creating one reverse DNS zone 0.10.in-addr.arpa, both methods are all right.
    Best Regards,
    Tina

  • ALE is a better practice for this requirement???

    Dear Friends,
    I'm in one Implementation Project. My client 'A' is having Mainframe System. My client's client 'B' is having SAP system.
    MAINFRAME <-> Txt File <- - - -> CENTRAL SERVER <- - - -> iDoc <-> SAP
    (Client A)          <- - - - - - - - ->       (For Data Mapping) <- - - - - - - - - - - - ->            (Client B)  
    The data is being transferred in the above fashion.
    If SAP is implemented in Client A (means that Mainframe will be replaced  by SAP), then how the data will be transferred?
    My task is to identify the suitable way for integration.
    Should we implement ALE concept in Client A as well?
    Is it better practice?
    Your valuable suggestions are rewarded with points.
    Thanks & Regards,
    Neeraj K

    Hi Neeraj,
    Welcome to SDN.
    If there is planning to change manframe to SAP for your Client A in the nearest future, I would recommend to use ALE IDoc interface from middeware system (data mapping system) to SAP Client B. In this case, when Client A is ready with SAP, you only need only to setup ALE IDoc interface in Client A without major changes interface in client B. Perhaps only performing unit and integration testing to ensure the data process flow is correct between SAP Client A -> Middleware -> SAP Client B or directly SAP Client A -> SAP Client B without middeware system.
    If there is no plan to change to SAP for your Client A, then perhaps you can use file base and BAPI interface. In other word, you can map the data source from mainframe and create flat file(s) in middeware system and send (FTP) to SAP Client B. Then the flat file(s) will be procesed via BAPI in SAP Client B.
    You can also use BDC solution as well for the interface.
    Hope this will help to start with.
    Regards,
    Ferry Lianto

  • BEST PRACTICES FOR CREATING DISCOVERER DATABASE CONNECTION -PUBLIC VS. PRIV

    I have enabled SSO for Discoverer. So when you browse to http://host:port/discoverer/viewer you get prompted for your SSO
    username/password. I have enabled users to create their own private
    connections. I log in as portal and created a private connection. I then from
    Oracle Portal create a portlet and add a discoverer worksheet using the private
    connection that I created as the portal user. This works fine...users access
    the portal they can see the worksheet. When they click the analyze link, the
    users are prompted to enter a password for the private connection. The
    following message is displayed:
    The item you are requesting requires you to enter a password. This could occur because this is a private connection or
    because the public connection password was invalid. Please enter the correct
    password now to continue.
    I originally created a public connection...and then follow the same steps from Oracle portal to create the portlet and display the
    worksheet. Worksheet is displayed properly from Portal, when users click the
    analyze link they are taken to Discoverer Viewer without having to enter a
    password. The problem with this is that when a user browses to
    http://host:port/discoverer/viewer they enter their SSO information and then
    any user with an SSO account can see the public connection...very insecure!
    When private connections are used, no connection information is displayed to
    SSO users when logging into Discoverer Viewer.
    For the very first step, when editing the Worksheet portlet from Portal, I enter the following for Database
    Connections:
    Publisher: I choose either the private or public connection that I created
    Users Logged In: Display same data to all users using connection (Publisher's Connection)
    Users Not Logged In: Do no display data
    My question is what are the best practices for creating Discoverer Database
    Connections.
    Is there a way to create a public connection, but not display it in at http://host:port/discoverer/viewer?
    Can I restrict access to http://host:port/discoverer/viewer to specific SSO users?
    So overall, I want roughly 40 users to have access to my Portal Page Group. I then want to
    display portlets with Discoverer worksheets. Certain worksheets I want to have
    the ability to display the analyze link. When the SSO user clicks on this they
    will be taken to Discoverer Viewer and prompted for no logon information. All
    SSO users will see the same data...there is no need to restrict access based on
    SSO username...1 database user will be set up in either the public or private
    connection.

    You can make it happen by creating a private connection for 40 users by capi script and when creating portlet select 2nd option in Users Logged in section. In this the portlet uses there own private connection every time user logs in.
    So that it won't ask for password.
    Another thing is there is an option of entering password or not in ASC in discoverer section, if your version 10.1.2.2. Let me know if you need more information
    thnaks
    kiran

  • What is better way for creating a thread? Why?

    A thread can be create in two way, extending Thread class or implimenting Runnable.
    What is better way for creating a thread? Why?

    Implementing Runnable
    See FAQ #1 here [http://forum.java.sun.com/ann.jspa?annID=9]

  • What are the best practices to create surrounding borders?

    Good day everyone,
    I was wondering what is the best practices to create a look in my iOS app like the one below? How are they accomplishing the creation of the borders, is there a tool in Xcode IB to do that?
    Thank you in advance

    Once again thanks for your input, however I am still not clear how you have accomplish the rounded corners, you do not mention that in your reply.
    I did some research on my end and I was able to accomplish what I want with a UIView using the code below in an outlet:
    redView.layer.cornerRadius = 10;
    redView.layer.borderColor = [UIColor greenColor].CGColor;
    redView.layer.borderWidth = 5;
    However, I cannot do the same for the UITableView or UITableView cell.
    Thanks

  • Best practice to create Voyager conn on SAP BI INFOCUBE OR  SAP BI Query

    I wanted to know which is the best practice to create a Voyager connection on SAP BI Infocube or SAP BI  Query?
    which is gud for more performance?

    Hi Nirmansyah,
    Please check the below link.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/business-intelligence/s-u/step-by-step%20procedure%20for%20creating%20customized%20bex%20maps.pdf
    Hope this helps.
    Veerendra.

  • Best practice to create a database

    please can you send me the best practice to create a database which is want to be used in the future for a dataware house

    Hi,
    For Dataware housing purpose only means you can create the database by using DBCA. or for only transctional purpose means you can create manyally. like create control file , datafiles and all.
    Thanks and Regards
    Venkat.K.Raju
    Mindlance,
    Oracle Applications Team
    BANGLORE..66
    Mobile:+919986556688
    Land:080-41464843 Ext-4942
    [email protected]

  • Best practice to create users - Hybrid scenario

    I would like to know what is the best practice for creating new users in a Hybrid scenario with all mailboxes hosted and no mailboxes on-premise.
    Currently when creating a new user we go to our local EMC and create a 'New Remote Mailbox'.  This creates the mailbox in Office365 and the local user account in one wizard.
    After the new user is created we have to manually add the user to the correct distribution groups, and security groups.
    We would like a way to create new users using a template which already has the correct distribution groups and security groups.  This is how we did it prior to setting up the Hyrbrid scenario.
    Is this possible?  Can we create a user from a template and have the mailbox created in Office365 at the same time?  We do not wish to create the mailbox locally then migrate it.

    Thanks for the response DJStatik.  I think this tool might be useful for creating users in bulk, however we are looking for a user template in the traditional sense.
    Occasionally we have a new user and (prior to O365) would 'copy' the template user to ensure correct groups etc.
    We have tried making users from the existing template we have, but in order to create the mailbox in O365, you need to 'mail enable' the user.  We have noticed that doing this process causes issues with Autodiscover for that particular user.
    To avoid the autodiscover issue, we have found it best to create the user and the mailbox in the same wizard - hence our new process that we would like a template.

  • Best practices to create Universe on top of SAP BW

    Hi Experts,
    I would like to know the Best Practices for Creating Universe on top of SAP BW.
    1. is it advisable to create Universe on top of SAP BW CUBE directly. in my case , we are starting a fresh BW implementation for one application on SAP BI.7 ; and BOE 3.1
    2. if we create a universe on top of BEX Query, what need to be done if want to upgrade to Business Objects 4.0 version.
    3. if we create a universe on BEX Query, will  SAP is going to support  universe on BEX for future releases.
    4. what is the support period for BEX and its integration with Business objects.
    Thanks
    Bhnau.

    Hi,
    1. is it advisable to create Universe on top of SAP BW CUBE directly. in my case , we are starting a fresh BW implementation for one application on SAP BI.7 ; and BOE 3.1
    First go through by below link.This guide describe how you can create universe based on Cube and Query and what features are available via Cube and Query.
    http://help.sap.com/businessobject/product_guides/boexir3/en/xi3_sap_olap_universes_en.pdf
    You can check on the Page 12 in the PDF what supported by Cube and BW Query while designing of a universe.
    Best practices says to design universe on top of one generic query for one Cube because CFK,RFK can not generate in the universe on top of BW Cube.
    2. if we create a universe on top of BEX Query, what need to be done if want to upgrade to Business Objects 4.0 version.
    check below links.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c0d937fa-1261-2e10-6388-e71afb6b5ff6?quicklink=index&overridelayout=true
    http://biguru.wordpress.com/
    Thanks,
    Amit

  • Best Practices for creating reports/Dashboards from BW systems

    HI Gurus,
    Best  Practices of creating BO Dashboards / Xcelsisus from BW systems
    Prasad

    You can use the BICS connector that leverages BW queries directly.  It is listed in the Connection Manager as "SAP NetWeaver BW Connection".  You will need both the ABAP and Java stack and SSO configured between the two.  You will also need to have SAP GUI and BEx installed on the machine you are doing development on.  Note that dashboards using this connection can only be hosted in NW Portal for the time being until the next release of BI 4.x platform.
    Here are some links on getting started with the BICS connector:
    [Building Fast and Efficient Dashboards with BW and Xcelsius|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/d0ab8cce-1851-2d10-d5be-b5147a651c58]
    [Requirements for BICS|http://wiki.sdn.sap.com/wiki/display/BOBJ/prerequisitestoXcelsiusandSAPNetWeaverBW+Connection]

  • Best practice for creating JCO destinations

    Hi All,
       I have a project which uses 10 to 12 BAPIs.What is the best practice
      1) Create 10 JCO destinations one for each BAPI .
      2) Create one JCO and use it for all BAPIs.
         Can some one tell me what is the best practice.What are the advantages and the disadvantages.
    Regards,
    Rajini.

    Hi,
    these docs helps you to get idea over the jco best practices.
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/705f2b2e-e77d-2b10-de8a-95f37f4c7022
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/85a483cb-0d01-0010-2990-c5168f01ce8a
    Regards,
    ramesh

  • Unable to get the composite instance for the invocation. This could be because instance has not yet been created or because the audit level for the SOA infra has been set to Off

    I am on Oracle 11.1.1.7 BPM suite on W8 64 bit. I can't launch the flow trace and get the error "Unable to get the composite instance for the invocation. This could be because instance has not yet been created or because the audit level for the SOA infra has been set to Off".  I have set the audit level to development at the soa-infra>SOA Administration> Common Properties > Audit level set to development and Capture Composite Instance State is Checked.
    Can somebody advice.
    Thanks

    Can you please confirm me the following steps...
    Log in to the EM console, Expand soa-infra (soa_server1) , go to the partition where your composite is been deployed, Click on your composite, On the right, click on the dropdown Settings and choose Composite Audit Level. you can choose to set the Audit Level for this composite. If you choose Inherit, it will take the settings to what the server is being set to. Otherwise, we can override it by choosing Off, Production, or Development.
    Make sure your setting for that composite is not Off, keep inherit or production or development.
    Thanks,
    N

Maybe you are looking for