Should it be public

If I have an ArrayList is my class that is going to be needed by virtually all classes should it be declared as public static ArrayList list. This way any class that want to use it can just refer to it without creating the object. Is this okay.

I'd suggest going a step farther and not even provide add, remove, or get methods.
Let's say that this ArrayList is in a class called Horse. Now let's assume that it's being accessed by some other method in a class called, say, Monkey. That method does something, right? It has some purpose, and some name. Let's say it's called Monkey.bobo().
Here's the thing. If there's some functionality out there that uses Horse's ArrayList, then chances are that that functionality should be in Horse. It shouldn't be in Monkey at all.
So move the bobo() method to the Horse class. Now it'll be Horse.bobo().
If it turns out that there's some functionality in bobo() that doesn't belong in Horse...then, for starters, your method isn't designed very well. Refactor it, so the stuff that's specific to the Horse's arraylist is in a (possibly new) method in Horse, and the stuff that's specific to Monkey is in bobo().

Similar Messages

  • Schedule webi report u2013 report should go under Public Folders in Info View

    Hi Experts,
    Schedule webi report
    Destination -> File System u2013 what directory path I should give to move reports under Public Folders?
    Is that possible to give the path of Public Folders as Destination directory?
    Regards,
    Sasi

    To see the latest instance of a report automatically you can change the default from view to view latest instance.
    CMC > Applications > Infoview  and select View the latest successful instance of the object
    Then when you double click on the report, it will open the latest instance.
    BUT if the report doesn't have an instance, eg only be run manually not via the schedule, the report won't open. You have to right click and select view.
    I've seen either here or in another forum that in XI 2 it will automatically open the report if it doesn't have an instance but in XI 3.1 it doesn't.

  • How do I set the default welcome page for PUBLIC user

    gurus,
    i'm using -
    Oracle 9i Database
    Oracle 9ias Portal Release 2
    QUESTION => how do I set the default welcome page for the PUBLIC user.
    i did the following to achieve this -
    1. logged into portal
    2. clicked on builder
    3. clicked on administer tab
    4. selected PUBLIC user in the Portal User Profile portlet
    5. went to the preferences tab
    6. in the default home page selected a custom page group
    7. logged out of portal
    8. open a new browsere session
    9. type the portal URL and i get the login page ....??
    i'm unable to understand this behavior ... shouldn't i be getting the page group that i set for the PUBLIC user in step 6 above ....
    the second QUESTION is => when the user logs out he/she should see the PUBLIC page set in step 6 above ... but, instead the user sees a page that is as follows -
    Partner Application Name Logout Status [Logout Status]
    Oracle Portal (portal) logout status
    The SSO Server (orasso) checkmark
    buzz.resva.trw.com:7778 checkmark
    infrastructure.happy.resva.trw.com checkmark
    portal1.buzz.resva.trw.com checkmark
    portal2.sylvester.resva.trw.com checkmark
    sylvester.resva.trw.com:7778 checkmark
    so, how can i set the default page for the PUBLIC user and also a page when he user logs out.
    ideas anyone ....?
    thanx a bunch.
    hero

    Hi,
    The sequence of operation you are doing to set the home page for public users is correct. You are getting the login screen as the "custom page group" selected as "home page" has not been granted to public.
    Also, while logging-out, it is normal behaviour to get the screen where it shows the list of partner applications from where user has been logged-out. When you click on "Return" button, you will get to the "home page" set above.
    Hope it clarifies the things.
    Regards,
    Ved

  • Static NAT Question - Public to Inside ASA 9.1x

    Hi All.. I'm having  hard time wrapping my head around the post 8.2 nat statements, please help.
    I have a DMZ server that has a list of ports that need to be accessible from the outside from specific IP addresses (this is a video streaming relay server).  It also need to be able to push the stream to a specific IP address as well.  I can do identity nat, and it'll go out and I see it's using IP, but obviously traffic doesn't get in... I can use sample web server nat's I've found and it works for the web management port, 8088, but I can't figure out how to map multiple ports to it:
    Remote Public IP's: 77.88.99.11
    Local Public IP: 12.12.12.1
    Ports required:
    object-group service srvgp-stream-remote
     service-object tcp destination eq www
     service-object tcp destination eq https
     service-object tcp destionation eq 8088
     service-object tcp destination eq 1935
     service-object udp destination range 6970 9999
     service-object udp destination range 30000 65000
     service-object udp destination eq 554
    I can get this to work:
    object network server-external-ip
     host 12.12.12.1
    object network webserver
     host 192.168.1.100
     nat (dmz,outside) static server-external-ip service tcp 8088 8088
    access-list acl-outside extended permit tcp host 77.88.99.11 object AngelEye eq 8088
    But again, I have no idea how I would do such a thing with a list of required ports? I don't see that's an option in the syntax.  Additionally, would this  provide an 'identity nat' in case the server had to send info out to the public ip via these same ports or do you require a seperate identity nat to do this to the same public ip addresses?
    Any help is greatly appreciated.

    With that many ports, you should use the public IP exclusively for the Webserver:
    object network webserver
    host 192.168.1.100
    nat (dmz,outside) static server-external-ip
    If it's not possible to use that IP only for that server, you can configure manual-nat for these ports:
    nat (dmz,outside) source static webserver server-external-ip service srvgp-stream-remote srvgp-stream-remote

  • I should create a new database link to an AS/400 server but i m rookie!!

    İ have an oracle 10g DB server.İ need get some of data from AS/400 DB on other location and put them all to my oracle server.İ should create a database link between oracle server and AS400 DB but how will i realize that event.in oracle 10g enterprise manager console i choose administration-database link-create database link.At this step how could i fill the requirement.Which format should i use.
    General
    * Name:????????     (should i type the AS400 IP?????)
    * Net Service Name:????????     (what should i fill)
    Public - This database link is available to all users.
    Connected User:
    Current User
    Fixed User
    Username     
    Password     
    Confirm Password     
    thanks for all as now

    İ have an oracle 10g DB server.İ need get some of data from AS/400 DB on other location and put them all to my oracle server.İ should create a database link between oracle server and AS400 DB but how will i realize that event.in oracle 10g enterprise manager console i choose administration-database link-create database link.At this step how could i fill the requirement.Which format should i use.
    General
    * Name:????????     (should i type the AS400 IP?????)
    * Net Service Name:????????     (what should i fill)
    Public - This database link is available to all users.
    Connected User:
    Current User
    Fixed User
    Username     
    Password     
    Confirm Password     
    thanks for all as now

  • Public class ArrayEx extends Array

    Hi, I'm very bad at OO programming, but I'm trying to learn.
    I want to add some functions to my Arrays, like checking if
    arrays contain a value (indexOf can be equal to 0, which is false,
    though actually I'm used to the loose data typing of as2, so this
    may not be quite true. Bear with me though, I want to learn how to
    extend a class). So I'm trying to write a class that extends the
    basic Array class.
    I am confused about the constructor, I want to mimic the
    behaviour of the Array class but I'm not sure if I need to write
    functions for each method of Array. Since my ArrayEx extends the
    Array class it should inherit the array functions right? So it
    should already have .pop() and .push() ext. defined? How should I
    write my constructor to store the data the same way as the Array
    class does though?
    Is there somewhere I can look at the internal Array class to
    figure out how it does it?
    What I have written so far appears at the bottom of the
    message. I include questions as comments.
    I hope someone can help me out. I'm sorry if I'm asking stuff
    that seems obvious. Thanks for your time.
    Jon

    I've found the solution to my second set of problems and
    since I chose to trouble you all with the question I thought I'd
    post the answer.
    First problem, I had declared the ArrayEx class as dynamic
    but not as public. Should read;
    dynamic public class ArrayEx extends Array{
    Second problem. An empty constructor function, by default,
    calls the parent constructor function with no arguements. Since I
    wanted to construct my new array class like the default array class
    i had to add some code to handle that.
    So here is the working class;

  • RAC public IP and VIP

    Hi
    I understand RAC requires 3ips for each node
    VIP -------------------->for near instantaneous failover and clients will be connecting to this
    Private IP ----------->For interconnect traffic
    Public IP ------------>Why is this required ?
    regards

    Public IPs : used to connect to the physical server (Host) OS LEVEL as you can not connect to VIP and Private IP. Public IPs allows you to connect using putty etc for remote connection.
    Private IPs: Should belong to separate class / subnet, should not share Public ip class. Recommendation is not to share for usual traffic.. Used for Heartbeat and Cache fusion.
    Virtual IPs : Used for Failover Management. VIPs are backbone of "RAC" , As Listener serves using these VIPs. After successfull cluster installation you should be able to ping these VIPs. before you cant.. you can also see weather VIPs are up or not.. ifconfig -a , VIPs should be plumbed in with public IPs. one more thing.. should be same subnet as Public IPs.
    It was quick over view really.. If you want more detail then please refer to Documentation.
    Thanks
    Prashant

  • When you use public?

    I'm brand new to java, so be patient with me. I noticed a lot of example code using a structure like...
    public class Demo
        public int variable...But then I found this...
    Avoid public fields except for constants. (Many of the examples in the tutorial use public fields. This may help to illustrate some points concisely, but is not recommended for production code.) Public fields tend to link you to a particular implementation and limit your flexibility in changing your code.So my question is, when should I use public?
    So how should I declare the fields so that this is possible? Public will do it, but I think thats bad practice.
    What I want to do is this, have a class with a bunch of fields that I want to access from methods outside of that class. For example, I have a Monster class, and the constructor sets up the monsters with fields like "hitPoints".
    I want a class outside of Monster to be able to use a line of code like this...
    if(damage >= monster.hitPoints)So how should I initialize the field?
    Edited by: MajorApus on Sep 6, 2008 9:20 PM

    Haha, I've been having similar issues, just in a different context. I should've come here first. Here's the same kind of issue, but in a different context.
    public class Blackjack{
         Dealer dealer;
         ArrayList<Player> players;
         public void playerTurn(Player p){
         public void dealerTurn(){
         public void newGame(){
         public void gameResult(){
         public void restart(){
         public static void main(String[] args){
    public class Dealer{
         private Deck deck;
         private Card facedown;
         public ArrayList<Card> faceup;
         public Dealer(){
         public void dealPlayerCard(Player p){
         public void dealSelfCard(){
         public int getHandValue(){
              return 0;
         public void giveEarnings(Player p){
         public void shuffle(){
    public class Player{
         private float earnings;
         private float wager;
         private ArrayList<Card> hand; //?
         private boolean bust;
         public Player(float e){     
         public boolean setWager(float w){
              return false;
         public int getHandValue(){
              return 0;
         public void addWinnings(float w){
    import java.util.ArrayList;
    import java.util.Collections; //for shuffling deck
    public class Deck{
         public static final int MAX_SIZE = 52;
         public static final String[] suits = { "CLUB", "DIAMOND", "HEART", "SPADE"};     
         public static final String[] faces = {"ACE", "2", "3", "4", "5", "6", "7", "8", "9", "10", "JACK", "QUEEN", "KING"};
         private ArrayList<Card> cards;
         public Deck(){
         public Card draw(){
              return null;          
         public void shuffle(){
    public class Card{
         private String suit;
         private String face;
         public Card(String suit, String face){
         public String getSuit(){
              return null;
         public String getFace(){
              return null;
         public int getValue(String face){
              return 0;
    }Edited by: KrazyKaiju on Oct 4, 2008 5:38 AM

  • Java compiler should check if wait() and notify()

    wait(), notify(), and notifyAll() methods should be called within a critical section, but the Java compiler does not check for this. It is usually during running that an Exception is thrown when the methods was not called within a critical section.
    To me, it seems that the compiler should check and enforce that wait(), notify() and notifyAll() be called within a critical section.

    I think I mis-understood you.
    Yes, you are right to say that because callNotify() was called within a critical section at some time, and may be called from other non-critical sections, so the compiler does not have means to keep trace of the calling stack.
    How about this:
    Because critical sections are always marked by the synchronized keyword, the compiler can actually keep count of the synchronized word and its corresponding braces, then when a wait(), or notify(), or notifyAll() call is made at certain point, the compiler just check for the nested synchronized cunt number, if it is non-zero, it will be syntaxically correct.
    Take the example of your code, I see that the proper point for
    public class Test {
      Object lock = new Object();
      public void lockObject() {
        synchronized (lock) {
          callNotify();                     // here the synchronized brace count is 1, so it is OK!
      private void callNotify() {
        lock.notify();               // here the synchronized brace count is 0,
                                            // but because it is a stand alone function, the compiler
                                            // can deliver warning information.
      public void dumbMethod() {
        callNotify();              // should deliver warning
      public static void main(String[] args) {
        Test t = new Test();
        t.lockObject();
        t.callNotify();                   // but here, the synchronized brace count is 0, so failure!
    }

  • How Sign Message with Certificate (public key)?

    Hi, I need to to send Sign xml message by Certificate file (public key) and read sign message
    so how can i do it ??
    and i should have 2 public key ?? or what ??
    please help :)
    Thanks

    ejp has answered your question, but it seems you did not understand. This forum is not a good place to learn about public key cryptography and message encryption. You should already understand these fundamentals before asking questions here. This forum is about how to implement these crypto operations in the Java programming language. If you are cheap or poor, you can try googling for the more information; wikipedia is good starting point also. If you can afford it, I recommend you buy Practical Cryptography_ by Schneier.

  • Migrate Exchange 2010 public folders cross forests

    Hi,
    Due to some Exchange and Active Directory issues (with remnants of old Ex 2003 server), we are going to migrate Exchange 2010 Mailboxes and public folders to a new Exchange 2010 Sp3 server, which is created in a new AD forest.
    One thing we still have to decide, which is how to migrate public folders.
    Apparently there are 2 ways:
    1. To export PF data to PST and then import using Outlook in destination Exchange server
    2. To use interorg replication tool to replicate PFs cross forest in target Exchange Server.
    I would really appreciate if someone suggests which one is best. We have around 100GB of PF data.
    Also, should we migrate Public Folders first? We think that we should move Mailboxes first.
    Thanks in anticipation.
    Regards, David Johnson

    Hi,
    Yes, when we decide to migrate from one Exchange server to another server, we need to move mailbox first.
    About migrating public folders, both of these two solutions are available, I think that the first one is simpler.
    Here is a similar thread for your reference.
    http://social.technet.microsoft.com/Forums/exchange/en-US/e3a23acd-efd2-4e51-bf4d-cb94b4b88a9f/exchange-2010-public-folder-cross-forest-replication-tool?forum=exchange2010
    Hope this helps.
    Best regards,
    Belinda
    Belinda Ma
    TechNet Community Support

  • SAP - Public Sector can conquer the World!

    Hi All,
    I have a confidence that one day all Governments in the World should have SAP - Public Sector (Industry Solution).
    For more information: SAP for Public Sector
    Its great if you can express your views and possibilities on the above topic.
    Regards,
    Siva kumar.

    Hi Siva kumar D,
    as far as i concern , it would  be  great if it happens, but it has a cost of its own,because taking the
    licence of sap and providing the end  user its training will be costlier, and i don't think  country like
    india will do it for all of its concern, yes it may possible that those companies which are in highest money makers will get this advancements, probablly because any end user  more generally never
    wants to change their way of working, because  they  have  to learn new thing ,   they have to adapt
    new technoligies, that means they have to expose themselves in new technologies.
    Now when they will work, certainly there wer many chnages of problem occurs in begining,and in
    the industry sector, no one wants to take its responsibility itself.
    So adapting a new technologies and working onto it, in govt. organisations are somewhat dficult
    , as you can see ONGC works in sap , but most of the persons working for ONGC are from  third
    party payroll.
    So in my opinion, it would be a better advantage for sap professionals, if govt. sectors will deploy it
    , because there will have plenty of  jobs in market, but adapting sap and providing sap training
    and then working for those people, who are adhere in old methods of working is somewhat
    difficult with respect to private sectors.

  • Data blocks in forms 6i, can not see the data

    i have built an application in forms with some data blocks. the blocks a connect to some tables in the db. i have built them connectd as "system". but when i run the applicatio as user x i can do select, insert, update, delete, but i can not se the records in the datablocks (they are empty), but i can do all transactios. why?

    First of all, developing from the System schema is not a good idea.
    Who owns the tables your form is connecting to? The table owner should create a public synonym for each table name, and also needs to grant user x access to the table.

  • How do I use a Netgear CM400 cable modem with my Time Capsule router?

    I switched out my TWC modem for one I bought. I called and activated a CM400 Netgear modem with time Warner cable. They said it is activated and responding. My time capsule is on a green solid light but i can't connect to the Internet! Why??

    Your previous setup may have been a modem router and the TC is connected in the wrong mode.. it should be dhcp and nat with a pure cable modem.. is it?
    You also might need to put the TC into the correct mode.. then power off the modem for about 15min.. (try 5min first).. power up the modem.. wait 5min and then power up the TC .. it should grab the public IP and route that to the network.. reboot all the clients so they get fresh connection and see if that works.
    If not give us a few screenshots from the airport utility of how the TC is setup.

  • View wife's Google calendar in iCal

    I have a bit of an unusual situation that I can't quite figure out. I use MobileMe, and all my calendars are on MobileMe so I can access them from iCal and my iPhone. I also have a Google account, but my Google calendar is empty. My wife, at her small business, has a Google calendar that should not be publicly shared, but has been shared with my Google account with read-only access. Is there any way that I can make that calendar show up in iCal, alongside my MobileMe calendars? (It'd be nice if I could see them on the iPhone as well.)

    Hi Thomas,
    If you are already syncing your Google Calendar with CalDAV and have permission to view your wife's calendar in Google. Go to iCal Preferences > Accounts, select your Google Calendar > Delegation tab and check your wife's calendar.
    Best wishes
    John M

Maybe you are looking for

  • "Unable to initialize video deck" inquiry

    I am new to Mac and FCE, so I ask for some slack... I am trying to get video from my Panasonic AG DVX 100 into FCE. About my system: IMac 2.4 GHz Intel Core 2 Duo with OS X 10.5.2. I have FCE 4 on this computer, not an upgrade of earlier program, but

  • MacBook Unibody (late 2008): audio + video to HDTV

    Have a MacBook Unibody (late 2008), and after reading forums, purchased a miniDP -> HDMI cable as well as a miniToslink to Toslink cable (3.5mm jack to Digital Audio Output).  Video works fine, but unfortunately, even with the red LEDs shining bright

  • Nokia 5800 Settings

    My Nokia 5800 has all the settings from Vodafone NZ on it and most of them work ok, I have also added wireless LAN, the settings I have are: WLAN VF NZ Internet (INTERNET) VF NZ PXT (MMS) VF NZ Gateway (WAP) The problem I have is that when I check my

  • Another not working...

    i was putting some new songs on my ipod and the update box came up, i clicked enter and went to update my ipod and then itunes went all funny looking (the text had duplicated and looked like there was a shadow). so i retsrtaed my computer because aft

  • Why does qmaster fail on my clustered computers?

    I'm using FCP 7 with compressor 3.5, and I'm getting failures when I try to run compressor against a Render Farm. I can't figure out why. All of my computers are set to managed, and I've used QAdministrator to build a cluster. My main iMac is also se