Must we uses generics always

Hi,
We are using eclipse as a tool with java 1.5 development.
But the tool issues warning for the below code.
ArrayList list = new ArrayList();The problem is it is expecting
ArrayList[u]<E>[/u]  list = new ArrayList();Is it wrong to ignore using the "Generics".
Or does it in anyway make the code non-compliant with 1.5.
I dont feel the need to use Generics,
so cant i ignore it ?
Any thoughts on this matter are appreciated.
Regards,
Shailesh

Is this the Java Kindergarden?In my experience, mostly yes.
Of course, one can use Java the raw fashion. The fact that you can doesn't make it a good idea. Generics are one of the most beneficial new feature in Java.
Generics
"only" provide some compile-time type safety in many
situations, but not all of them. Often enough, you
will work with bound types or even wildcards, which
not helps much.In most cases compile-time is the best time to be as safe as possible.
It surely is possible to safely develop applications
with less or no types (e.g. dynamic typing, cf. Ruby,
Smalltalk, Python etc.).Of course it is, it's also easier to make mistakes which burn you at runtime.
It all depends on who will
write the code, who will maintain the code, and how
experienced the developers are.In which case I find it best to assume the worst.
Comparisons to assembler or register manipulations
are quite off. Types alone do not guarantee a stable
or maintainable application.But they do help.

Similar Messages

  • I have a annual plan, it supposed must be used in two terminals, but i haven´t been able to install any app in a second computer, it always says that the app is only available as a trial download. What can I do to solve this issue, and be able to use my p

    I have a annual plan, it supposed must be used in two terminals, but i haven´t been able to install any app in a second computer, it always says that the app is only available as a trial download. What can I do to solve this issue, and be able to use my paid plan in two computers?

    Hi Susan,
    Please refer to the help document to fix this issue:
    Creative Cloud applications unexpectedly revert to trial mode | CS6, CCM
    You may also refer to the thread as below:
    creative cloud software says my free trial has expired, but I have a paid subscription
    Regards,
    Sheena

  • Where and when to use generics?

    I'm brushing up on Java 5.0, I'm at 'generics' - I always hated c++ templates and knew they would catch up with me sooner or later...
    I have a fairly simple question about where and how to use them, conceptually.
    Am I correct in thinking that they are primarily concerned with items contained within a class and passed to a class?
    I'm trying to find a useful bit of code to write to practice with them and I've been half tempted to re-write something that uses lots of inheritance simply because I know the code in question needed a lot of casting, but my gut feeling is that generics doesn't have an awful lot to do with inheritance and re-jigging a class that relied on inheritance to use generics is barking up the wrong tree.
    I'd really appreciate some informed comments before I go trundling off down a path that is going to end with reams of pointless code.
    Thanks,
    Steve

    IMO the most useful feature of using Generics is compile time typesafety.
    Consider the pre-1.5 code for making a LinkedList that contains strings:
    LinkedList l = new LinkedList();
    l.add("Hello world!");
    l.add(new Integer(100));    // <---- runtime exceptionInstead, you can now write the code like this:
    LinkedList<String> l = new LinkedList<String>();
    l.add("Hello world!");
    l.add(new Integer(100));    // compile time exceptionIf you accidentally put the wrong type in a Collection you will get a nice compile time exception instead of a ClassCastException at runtime.

  • variable-class using Generic Collection

    Within my TLDs I would like to use the <variable-class> attribute as much as possible for the sake of JSP authors.
    I cannot figure out how to specify that a varAttribute will be a generic collection. IE, if I want to return a set of strings, I would like to do
    <variable-class>
    java.util.set<java.lang.String>
    </variable-class>
    Of course I must escape the <,> and I tried using < and > but it was not effective.
    Is this even possible? I would appreciate any comments suggestions.

    Currently we are using a single domain account on every machine in this kiosk area. They are using just Internet Explorer and Adobe Reader. We are using Group Policy to lock down the machines. Each station is a full computer (older Dell OptiPlex) running
    Windows 7. We are looking at the possibility of removing the OptiPlex computers and replacing them with Wyse terminals. The backend would be a cluster of 3 servers running Hyper-V 2012 R2. On those would be running Windows Server 2012 R2 RDS.  We have
    tested this setup, but when creating the VDI collection there doesn't seem to be a way to use generic domain accounts. 
    Every person that uses these does not have an AD account and it looks like that would be a problem when trying to implement this.  I was just checking here to see if anyone had any ideas or had gone through a similar setup.

  • Sample Javadoc comments for classes or methods using generics?

    Can anyone show me a sample Javadoc comment for a class or a method that uses generics. All my attempts so far ended up in warnings from the Javadoc tool..
    I also looked in the Sun forums, in the Javadoc documentation, but nowhere could I find anything that would help me write correct javadoc comments.
    Any luck for you guys?
    Thanks a lot,
    -Laurent

    Thanks man, sorry it must seem obvious to you, but
    for some reason I couldn't get it to work.No. The first time I also had to ask.
    Now an even more difficult (for me) question: how
    would you refer to that method in a @see or {@link
    ..} javadoc comment?Manually erase the method:
    * The see tag refers to this method
    * @param <T> a type variable
    * @see #foo(Object)
    <T> void foo(T t) {}

  • Identity must not be Generic

    Hi,
    For introduce you to my problem, i'll list my server spec before:
    - Windows 2012 R2
    - Sharepoint 2013
    - Project Server 2013
    I develop a event handler for a site collection (PWA).
    When I try to get the list of events by WCF with the service "http://servername/_vti_bin/PSI/ProjectServer.svcon the activate of the feature, I got in the ULS the error "Identity must
    not be Generic".
    When I check before the error in the ULS, it's show that I try to connect with the IIS anonymous user (nt authority/iusr).
    I try to create a channel with delagation or impersonalisation and also in kerberos or ntlm but nothing work.
    For a little test, i try to give permissions of farm admin to the IUSR but that did'nt work.
    Did someone know the source of my problem and how to correct ?
    Thank you in advance.

    If you talk about the Eventing Service of Project, he run with a account that is farm administrator.
    For the Binding, I use a BasicHTTP binding with the code like this:
    const HttpClientCredentialType CONST_CLIENTCREDENTIALTYPE = HttpClientCredentialType.Ntlm;
    const TokenImpersonationLevel CONST_ALLOWEDIMPERSONNALISATIONLEVEL = TokenImpersonationLevel.Impersonation;
    binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);
    binding.Name = "basicHttpConf";
    binding.SendTimeout = TimeSpan.MaxValue;
    ((BasicHttpBinding)binding).MaxReceivedMessageSize = 500000000;
    ((BasicHttpBinding)binding).ReaderQuotas.MaxDepth = 32;
    ((BasicHttpBinding)binding).ReaderQuotas.MaxStringContentLength = 8192;
    ((BasicHttpBinding)binding).ReaderQuotas.MaxArrayLength = 16384;
    ((BasicHttpBinding)binding).ReaderQuotas.MaxNameTableCharCount = 500000000;
    ((BasicHttpBinding)binding).ReaderQuotas.MaxBytesPerRead = 4096;
    ((BasicHttpBinding)binding).Security.Transport.ClientCredentialType = Common.GeneralUtility.CONST_CLIENTCREDENTIALTYPE;
    ((BasicHttpBinding)binding).Security.Transport.Realm = "";
    EndpointAddress address = new EndpointAddress(pwaUrl + svcRouter);
    eventsClient = new SvcEvents.EventsClient(binding, address);
    eventsClient.ChannelFactory.Credentials.Windows.AllowedImpersonationLevel = Common.GeneralUtility.CONST_ALLOWEDIMPERSONNALISATIONLEVEL;
    I try yesterday to enter in Debug Mode of the feature and when i call the method "System.Security.Principal.WindowsIdentity.GetCurrent().Name;"
    is the command window, he give me the credential "nt authority\iusr".
    Also I try another way to call the WCF service, to call it from an custom csharp assembly and it's working (the credential are okay).
    The problem seem to be that on the click of the activate of the feature in the panel, the action is made anonymous.

  • Must I Use Reflection?

    Hi, i posted here this question, �cause it�s about DB and JDBC.
    I`m coding a simple visual program, to connect with JDBC.
    i have a field, who capture the path of the DB, and i need to get form there, the string:
    "sun.jdbc.odbc.JdbcOdbcDriver"
    must i use reflection to get it?
    Or there�s another way to do this?
    Thanks a lot.

    Your question makes no sense.
    The value you posted represents the name of a particular JDBC driver.
    The string itself is a string. Nothing more. Nothing less. You can get it anywhere you can get a string from. Like a text file, a properties file, a command line option, hard coded etc. Just like you can do the same with other string values.
    You certainly can't get that string from a jar file, just by itself.
    No perhaps you mean the driver itself and not the string?
    Then the answer is no - you can't get it from a "jar". That particular driver is a proprietary driver that only comes with the Sun VM (how it lives in the VM is irrelevant to the question.) And that is the only way you can use it. If you run your app in a Sun VM then it is always there. If it isn't a Sun VM then it isn't there.

  • What hosting platform must i use with iweb? unix or microsoft

    what hosting platform must i use with iweb? unix or microsoft? This is a question from my ISP.

    You should always pick Linux hosting and NOT Windows - this causes more problems than it is worth.
    If your ISP is asking this question, then consider changing - they should know this.

  • TS1506 I just updated my IOS to 7.1 and now I can't open Microsoft attachments - I used to always do it. Help - I use my iPad for work and now can't see any attachments.

    I just updated my IOS to 7.1 and now I can't open Microsoft attachments - I used to always do it. Help - I use my iPad for work and now can't see any attachments. I've tried opening straight into other apps and just get error messages, and I the mail preview there is just a grey screen telling me the file name and size. It worked fine until I did the IOS upgrade

    Troubleshooting apps purchased from the App Store
    http://support.apple.com/kb/TS1702
    Delete the app and redownload.
    Downloading Past Purchases from the iTunes Store, App Store and iBooks Store
    http://support.apple.com/kb/ht2519
     Cheers, Tom 

  • Right way to use generics for cellular automatons?

    Hi,
    i've got a question about using generic types in combination with subclassing (which should be used in a cellular automaton),
    In fact there are only 3 classes that are necessary to understand my problem:
    - Cell (abstract)
    - CellularAutomaton
    - SubclassedCell (extends Cell)
    These classeses work as follows:
    A cellular automaton holds some cell's with respect to the order they were added. The cell itself holds some properties and the most important function in this small "framework". This function is "performCellAction(CellularAutomaton ca)". It retrieves the "neighbor" cells from the given parameter and calculates a new state using these neighbors.
    The way i implemented this using generics is:
    public class CellularAutomaton<T extends Cell>{
      private List<T> cells;
      public T getLeftNeighbor(T cell) { ... } // gets the left neighbor of the given cell
      public T getRightNeighbor(T cell) { ... } // gets the left neighbor of the given cell
    public abstract class Cell [
      public void performCellAction(CellularAutomaton<? extends Cell> ca) {}
    public class SubclassedCell extends Cell {
      private String str;
      public void performCellAction(CellularAutomaton<? extends Cell> ca) {
        Cell left = ca.getLeftNeighbor();
        // PROBLEM:
        // How to call left.getStr() here???
        // How can i be sure that ca contains objects of class subclassedCell (or objects of subclasses of subclassedCell) ... and not objects of class cell or another subclasses cell
      public String getStr() {}
    }In fact i found "something like a solution", which looks like this:
    public class CellularAutomaton<T extends Cell>{
      private List<T> cells;
      public T getLeftNeighbor(T cell) { ... } // gets the left neighbor of the given cell
      public T getRightNeighbor(T cell) { ... } // gets the left neighbor of the given cell
      public void computer() {
        for (T cell: cells) {
          // compiler warning here!!
          cell.performCellAction(this);
    public abstract class Cell<T extends Cell<?>> [
      public void performCellAction(CellularAutomaton<T> ca) {}
    public class SubclassedCell extends Cell<SubclassedCell> {
      private String str;
      performCellAction(CellularAutomaton<SubclassedCell> ca) {
        SubclassedCell left = ca.getLeftNeighbor();
        left.getStr(); // works here
      public String getStr() {}
    }However, even in this "working" solution i get a compiler warning at the method CellularAutomaton->computer():
    The warning is Type safety: The method performCellAction(CellularAutomaton) belongs to the raw type Cell. References to generic type Cell<T> should be parametrized and Cell<T extends Cell<?>> also looks very uncommon to me.
    Is there a betted way to achieve the goal to access left.getStr() in the performCellAction of the subclassed cell??
    Regards,
    Niko

    I thought of that myself, but if i do this, i get the following error:
    The method performCellAction(CellularAutomaton<capture#1-of ?>) in the type Cell<capture#1-of ?> is not applicable for the arguments (CellularAutomaton<T>)

  • How to use Generic Object Services(GOS) for each table control record.

    Dear Expert,
                       I am using generic object services for document attachment but i am facing a problem while attaching document to a table control row. my requirement is to attach separate document for each and every row of table control but  i am unable to attach document row wise of the table control.for each row GOS should display corresponding attached document not all the attached document.
    Thanks in Advanced
    Bhuwan Tiwari
    Edited by: BHUWAN TIWARI on Feb 8, 2011 4:16 PM
    Edited by: BHUWAN TIWARI on Feb 8, 2011 4:16 PM

    You haven't explained what object and object key you're using, nor have you provided any indication of how you implemented the GOS attachment functionality.  You need to provide more information to resolve an issue like this.

  • I have developed a fillable form using Adobe Acrobat Pro. The form has several fields and some of the information is captured in a bar code. What programs must be used to open the form to properly fill the form out?  Adobe Reader, Adobe Xi, Ibook, etc.. I

    I have created a fillable form using Adobe Acrobat Pro that contains several data fields with some feeding data to a barcode in the document.  I have a "button" set up to save and send the completed form one it is completed.  Some of the user are having troubles filling out the form as they are using various programs to do such as iBook, Adobe Reader, etc....  Sometimes the information is not transferred to the barcode and sometimes the "submittal button" doesn't function properly.
    Please provide a solution or give me a list of the programs that must be used to properly open and fill out the form.
    Greatly appreciated.

    Best option is to use Adobe Reader (or Acrobat, of course) on a desktop computer (ie, not on a mobile device). Any other configuration is likely to be problematic.

  • Attach doc from external content server- using Generic Object Service (GOS)

    Dear All,
    i have intergrated an external content server to SAP using SAP archive link. All the scanned document are there in Content server and corresponding entries are done in SAP.I can search and view document using tcode : OAAD
    Please tell me steps for "how to attach a document from external content server using Generic Object Service "
    Scenario is :  For example when we change any Master records or create a new PO, or do some financial transaction then i need to attach the supporting document which is there in my content server connected  to SAP.how do we manual attach a Document in SAP using GOS.
    Do we need to do some special configuration to use GOS .please give the steps from initial.
    Thanks
    sandeep

    Hello,
    Check your configuration of document type assignement to required business document - object type, Archivelink table, content repository in OAC3 transaction.
    Goto respective business document > Click on GOS > Create > Store business document - Here you can see defined document type with desctiption. Double click on this the assign your document to this business document. Save it.
    This will help in attaching the document to your required business document.
    To verify you can check the archivelink table or by transaction OAAD.
    Hope this will help you.
    -Thanks,
    Ajay

  • How to attach document using Generic Object Service

    Hi all,
    How can i create attachment to the parked invoice using Generic Object services? i want function modules which are used to do it.
    Actually I want to do this from the business object method. I am having word document as one of the workitem step. once i get this document I need to attach this document to the parked invoice so that users can see that document by view object list.
    Its urgent.
    thanks.

    Hello,
    Check your configuration of document type assignement to required business document - object type, Archivelink table, content repository in OAC3 transaction.
    Goto respective business document > Click on GOS > Create > Store business document - Here you can see defined document type with desctiption. Double click on this the assign your document to this business document. Save it.
    This will help in attaching the document to your required business document.
    To verify you can check the archivelink table or by transaction OAAD.
    Hope this will help you.
    -Thanks,
    Ajay

  • Attach Documents using Generic Object Services

    With reference to Manual Bassani's SDN Contribution of code examples on how to attach documents using Generic Object Services - we have found that since implementing ECC 6 the following code no longer works (at the end of page 9):
    CALL CREATE ATTACHMENT SERVICE FROM TOOLBAR
    WHEN 'ATTACH'.
    CALL METHOD MANAGER->START_SERVICE_DIRECT
    EXPORTING
    IP_SERVICE = 'CREATE_ATTA'
    IS_OBJECT = OBJ
    EXCEPTIONS
    NO_OBJECT = 1
    OBJECT_INVALID = 2
    EXECUTION_FAILED = 3
    OTHERS = 4.
    It is necessary to use IP_SERVICE = 'PCATTA_CREA' to get this to function correctly.
    The original document can be found at [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/0e6b0d95-0a01-0010-4696-ca0a48de5fb3]

    Check the Naimesh Patel Blog he explain very well
    http://help-abap.blogspot.com/2009/02/generic-object-services-gos-toolbar.html

Maybe you are looking for

  • Can i sync an ipad and iphone on the same computer

    I've got an iPhone 3GS and am thinking of getting an iPad 2 as well.  How does syncing the 2 devices on the same computer work?  Also, can I share Apps that I have purchased across the 2 devices, or do you have to pay for them twice?

  • ORA-00600: internal error code, arguments

    Hi, I got this error: ORA-00600: internal error code, arguments: [ttcgcshnd-1], [0], [], [], [], [], [], [] when i execute this SQL select * from br_portal_bill from Java to Oracle9i and I got correct result from PL/SQL, may I know how to fix this pr

  • Invoking a JPanel in a Frame

    How do we invoke a JPanel in an existing JFrame on an Action event.

  • Why can't I delete photos from my iPhone 5.0.1 OS?

    Just upgraded to this iOS version which was a pain in itself!!!  Now there is no "Delete" option in my photo albums for photos. What gives?  Anyone else having this problem? I am running latest iTunes and a Mac 10.6.8 Thnaks, Amy

  • Changing a presentation author

    G'day I set up a basic prsentation for a friend with the intention of handing it over to him. I am the Author and I have made him a coauthor. How do I make him the Author and remove myself? I notice there appears to be no way to copy and download a p