What are the runtime advantages of using Java generics?

I have downloaded Build 31 (courtesy of JavaLobby) and compiled the following program.
Both methods (main and main2) are compiled to the exact same bytecodes (use javap -c to dump the bytecodes). I believe that the generics version (main) is clearer and cleaner (I regularly use templates in my C++ programs), but for the JVM they are exactly the same thing.
Why did not the JVM was slightly modified to support without using erasure (the checkcast opcode that is used in compiling (String) it.next() could be eliminated in for (String v : s) )?
// Compile with: javac -source 1.5 Test15.java
import java.util.*;
public class Test15 {
     public static void main2(String[] args) {
          Set s = new TreeSet();
          s.add("one");
          s.add("two");
          s.add("three");
          for (Iterator it = s.iterator(); it.hasNext(); ) {
               String v = (String)it.next();
               System.out.println (v);
     public static void main(String[] args) {
          Set<String> s = new TreeSet<String>();
          s.add("one");
          s.add("two");
          s.add("three");
          for (String v : s) {
               System.out.println (v);

It is not meant to be faster than the normal approach, it is meant to be easier to implement and more secure.
Why did not the JVM was slightly modified to support without using erasure
(the checkcast opcode that is used in compiling (String) it.next() could be
eliminated in for (String v : s) )?I agree, and more do, that the erasure is somewhat the wrong approach, however, the JSR proposal wants it that way.

Similar Messages

  • What are the main advantages of using the IP Spoofing options in OLT?

    We are currently re-thinking our deployment of OATS (currently only 2 agent machines) and I was wondering about the benefits of using IP spoofing. Has anyone got any experience of using this feature (examples of when it's required)?
    What sort of scenarios does tests coming from multiple IP addresses assist with (I can think of issues with load-balancing depending on how this is configured)?
    I'm aware of the issue with ephemeral port exhaustion (mentioned in the OATS release notes) but would IP spoofing help?

    The "Known Problems, Limitations and Workarounds" section of the OATS Release notes usually mentions the following (which I've seen referred to as ephemeral ports before):
    Problem: Load tests on agent machines running Windows XP or Windows 2003
    may experience TCP port exhaustion during load testing. When too many TCP
    ports are opened on the agent machine, virtual users may fail with errors such as:
    java.net.SocketException: No buffer space available (maximum connections
    reached?)
    and
    The attempt to connect to the server XXXXX on port NNNN failed. Comparable
    WinInet error code: error 12029: ERROR_INTERNET_CANNOT_CONNECT. Caused by:
    java.net.BindException occurred. Error Message: Address already in use: connect
    Resolution: By default, Windows XP and Windows 2003 only allow 5000 TCP
    ports. This number should be increased according to the steps here:
    http://msdn.microsoft.com/en-us/library/aa560610(v=bts.20).as
    px
    In Windows Vista and Windows Server 2008, the default port range is increased
    from 5,000 to about 65,000 ports:
    http://support.microsoft.com/kb/929851/

  • What are the security implications of having JAVA running on my Mac Book Pro?

    What are the security implications of having JAVA running on my Mac Book Pro?

    Java on the Web (not to be confused with JavaScript, to which it's not related, despite the similarity of the names) is a weak point in the security of any system. Java is, among other things, a platform for running complex applications in a web page, on the client. That was always a bad idea, and Java's developers have proven themselves incapable of implementing it without also creating a portal for malware to enter. Past Java exploits are the closest thing there has ever been to a Windows-style virus affecting OS X. Merely loading a page with malicious Java content could be harmful.
    Fortunately, client-side Java on the Web is obsolete and mostly extinct. Only a few outmoded sites still use it. Try to hasten the process of extinction by avoiding those sites, if you have a choice. Forget about playing games or other non-essential uses of Java.
    Java is not included in OS X 10.7 and later. Discrete Java installers are distributed by Apple and by Oracle (the developer of Java.) Don't use either one unless you need it. Most people don't. If Java is installed, disable it — not JavaScript — in your browsers.
    Regardless of version, experience has shown that Java on the Web can't be trusted. If you must use a Java applet for a task on a specific site, enable Java only for that site in Safari. Never enable Java for a public website that carries third-party advertising. Use it only on well-known, login-protected, secure websites without ads. In Safari 6 or later, you'll see a lock icon in the address bar with the abbreviation "https" when visiting a secure site.

  • What are the transaction codes we use for LSMW in MM, SD, PP  & FI/CO gnrly

    Hi all,
    What are the transaction codes we use for LSMW in MM, SD, PP  & FI/CO generally?
    Help will be surely rewarded.
    Thanks and Regards,
    Creasy

    > What are the transaction codes we use for LSMW in MM, SD, PP  & FI/CO generally?
    General threads about LSMW in MM, SD, PP, FICO will be locked and deleted generally.
    > Help will be surely rewarded.
    &********************** Please read "the rules" if found usefull... ************************&
    Cheers,
    Julius

  • What are the major risks buying used lenses ?

    i just bought my first dslr,  and i was wondering what are the major risks buying used lenses ?

    You need to be able to inspect and test the lens.
    Look for obvious signs of physical damage, drops, etc. (cracks, dents, etc.)  A lens normally will get some signs of wear but as it's a used lens, you expect *some* wear... you're really looking for signs of damage.
    Remove both front and rear caps.  Look through the lens into a bright no-contrast background (a white wall, a blue sky, etc.) and check the optics.  You're looking for signs of mold growth or damage to coatings.  Minor dust on internal optics wont impact the lens performance... so while you wouldn't want major amounts of dirt... don't worry too much about minor bits of dust (I've actually helped prove this to someone by clipping a 3M PostIt note down to a tiny 1/4" x 1/4" size and sticking it on the front glass.  Take a photo... nothing shows in the photo (even a piece of "dirt" that big wont show because the camera cannot focus on anything that close to the lens.)  
    Rotate the focus ring from end to end.  You should feel a smooth and consistent amount of friction as you rotate the focus ring.  There should be no rough spots.  Listen to the lens as you do this... there should be no grinding noises.
    Do the same with the zoom ring but in addition to checking for smooth consistent performance (no sticky or rough spots) you're also checking to make sure nothing seems excessively worn (nothing wobbles loose... very heavily used lenses can do that after enough wear.)
    Connect the lens to the camera and make sure the camera can completely operate the auto-focus motors without a problem and/or if it's an image stabilized lens that the IS components are working.
    Set the camera to max aperture (e.g. f/22, f/32.. depending on the lens) and press your camera's "depth of field preview" button (if you don't know which button is your DOF preview, check your manual.  Canon tends to move that one around a bit but it's almost always on the front side of the camera near the lens mount.)  You want to press and release it a few times.  This will cause the lens aperture blades to stop down to the aperture you set.  Release... do this while watching the lens.  You should see the aperture blades move in and out (well... they snap in and out very quickly).  You want to make sure it works ok, the camera gets no error codes, and there's no signs that anything is sticking.
    And then there is the focus test... 
    Focus the camera preferably at a FLAT surface that has lots of detail.... such as the brick wall of a building.  Make sure the camera is level and that the camera's focal plane is parallel to the plane of the wall.  Take a test photo at low f-stop and inspect.  You're checking to verify that the focus works and that the focus is reasonable across the image.   As you inspect from left ot right and top to bottom you are looking to make sure the focus is more or less equal (if the right side of the image is focused... but the left side of the image is soft... it would indicate that lens elements are skewed (lens isn't collimated).  It's difficult for a lens to get into this situation unless it was dropped and you'd probably see signs of damage.  
    Tim Campbell
    5D II, 5D III, 60Da

  • What are the common APIs we use in oracle interface

    What are the common APIs we use in oracle interface,and any APIs are there for validation Of data During Tranfer to interface table.
    How to find Api s in oracle applications in Individual modules

    For 11i, all public APIS are listed at http://irep.oracle.com
    For R12, use the "Integration Repository" responsibility in your R12 instance to list the APIs available in that instance
    HTH
    Srini

  • What are the possibilities sending notifications using TTY

    What are the possibilities sending notifications using TTY? And how to integrate TTY with Siebel

    Here are the possibilities of Content search webparts
    http://office.microsoft.com/en-in/office365-sharepoint-online-enterprise-help/configure-a-content-search-web-part-in-sharepoint-HA104119042.aspx
    http://office.microsoft.com/en-in/office365-sharepoint-online-enterprise-help/when-to-use-the-content-query-web-part-or-the-content-search-web-part-in-sharepoint-HA104206662.aspx
    Compare the strengths and limitations of the Web Parts
    It’s important that you understand the strengths and limitations of the two Web Parts because if you choose the wrong one, your site could run into performance problems. You can use both Web Parts to show content that is based on a query. In a simplified
    world, here’s how you can decide between the two:
    Use the CQWP when you have a limited amount of content, your query is simple, and you don’t expect your content to grow much in the future.
    Use the CSWP in all other scenarios when you want to show content that is based on a query.
    The table below gives a comparison of the two Web Parts:
    Web Part behavior
    Content Query Web Part
    Content Search Web Part
    Query configuration
    Easy
    You’ll need to know about certain search features such as
    managed properties.
    Query across large amounts of content
    Limited
    Yes
    Handle complex queries
    Limited
    Yes
    Scale to handle future content growth
    Limited
    Yes
    Display content from other site collections
    No
    Yes (see
    section below)
    Design of query results can be customized
    Yes, by using XSLT.
    Yes, by using HTML.
    Maintenance cost in a complex site architecture
    High
    Small (see
    section below)
    Narrow down the query results that are displayed in the Web Part
    No
    Yes, in combination with the
    Refinement Web Part.
    It was not there previously but then it was added to Office 365
    http://blogs.office.com/2013/10/29/search-innovations-for-site-and-portal-design-in-sharepoint-online/
    If this helped you resolve your issue, please mark it Answered

  • Firefox has many versions, what are the 10 most widely used versions?

    Firefox has lots of versions, what are the 10 most widely used versions currently?
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727)

    http://www.w3schools.com/browsers/browsers_firefox.asp

  • What are the important standard table use in FI/CO module?

    What are the important standard table use in FI/CO module?
    Moderator Message: Please avoid asking such queries.
    Edited by: kishan P on Jan 24, 2012 12:37 PM

    Hi Sanj,
    Please go through the available information and then you can ask if there is any queries.
    [Google|http://www.google.co.in/search?sourceid=chrome&ie=UTF-8&q=importanttablesinficoin+sap]
    Regards,
    Madhu.

  • 4.6C to ERP6.0 Upgrade - what are the recommendations for Unicode and Java

    Hi All,
    Forgive such a basic question.
    We are just beginning to look at our ERP6.0 upgrade and am unclear whether we should convert to unicode at the same time, and also what are the uses for the Java stack.
    Unicode?
    We are a single language Latin-1 site so don't need Unicode. However will it become mandatory eventually? Are we better, if we have the opportunity now, just to convert. Also I believe the Java stack is only Unicode. Does ASCII ABAP and Java Unicode complicate things?
    Java?
    Will we need it? We are proposing a technical upgrade from our 4.6c Javaless environment. Where does Java come in to play in ERP6.0? Doesn't it increase greatly the iSeries HW requirements? (I'm looking at a 2 way 550 at the moment)
    Look forward to hearing your views.
    Regards
    Steve

    Hi Stephen,
    at the moment, in a latin-1 environment Unicode is for old customers not a requrirement. This might change in 5-10 years ...
    Java: No problem at all with ASCII (in latin-1 environments)
    => there is no need for you, but you could go for it. We did several Unicode conversions already and these Latin-1 conversions are pretty easy and simple especially on iSeries, because of the special InPlace Unicode Conversion.
    ... but this can be done at any time ...
    Regards
    Volker Gueldenpfennig, consolut.gmbh
    http://www.consolut.de - http://www.4soi.de - http://www.easymarketplace.de

  • What are the general effects of using recovery mode, and is it possible for one's data to be backed up on to it afterwards?

    My iPad, in my opinion is a great device to have whenever I need to use it for work - mainly using it for creating music.  However I feel that it's a bit outdated, and I plan to get a new iPad Air for this holiday season and give this one to my children.  That being said, I have stumbled across a weird problem that keeps me from backing my iPad (generation 2) up to my computer.  The error in question states that "The iPad is currently owned by another computer."  By looking around on the internet, I was able to deduce that one of the ways to solve this problem was to put it in recovery mode to get rid of the 'ownership', and this seems logistical.  The problem I'm facing now, is that, after trying to find the answer, I do not know how recovery mode has an impact on all the data stored on my iPad.  To clarify the question into three parts:
    1)  Is there a way to back up files from my iPad and easily retrieve them without the use of iTunes?
    2)  If not, is there a way to get rid of the 'ownership' of another computer other than recovery mode WITHOUT jailbreaking it?
    3)  If still no, then what are the effects of putting my iPad into recovery mode, and will all of my songs and data be safe?
    Thank you for answering, if possible.

    Was the iPad originally set up on a different computer, and hasn't been synced to the one that you are now trying to use ? There are some instructions on this page for syncing to a new computer : https://discussions.apple.com/docs/DOC-3141
    (Before trying that you could copy any important files/documents off the iPad so that you have you own backup copy of them e.g. depending upon what the apps support then email them to yourself, use Dropbox, copy them to your computer via your wifi-network.)
    You should be able to copy iTunes purchases off the iPad and over to that computer's iTunes via File > Devices  Transfer Purchases, but if you have music from other sources (e.g. copied from CDs) which aren't in that computer's iTunes (and you haven't got a backup to copy them onto it from) then there are some programs listed half-way down this page which should be able to copy them back : https://discussions.apple.com/docs/DOC-3991
    For recovery mode, that will result in your iPad being put back to factory defaults i.e. all of your content will be removed from it

  • What are the best settings to use for the newest AirPort Extreme (AC wifi) with my optimum online service provider?

    I have the current generation of the AirPort Extreme and a handful of devices that utilize the new 5Ghz A/C frequency. My internet speeds were blazing fast when I had first set it up but lately it has been lagging terribly. I was told that changing my dhcp did help, which it did it seems like it might be back to its normal speeds but I just want to know what are the best settings to configure for the airport so that I can get the most out of my service on all my devices? I'm using a CAT 6 cable which does help, I have a guest wifi setup with a wifi password which I understand will slow it down a little. Can anyone just point me in the right direction or just give me a step by step guide on what settings to configure? Should I really consider turning off the guest network?

    I am assuming that you are looking to configure your network to provide the highest level of bandwidth possible for your network clients. If that is the case, the following are a few things to consider:
    The Internet modem should support Gigabit Ethernet. That is the Ethernet connection between the modem and your 802.11ac AirPort Extreme should be Gigabit Ethernet.
    Use CAT-5e or CAT-6 Ethernet cables between all wired connections.
    Only expect 802.11ac performance with 802.11ac clients in the same room as the base station.
    Eliminate or significantly reduce any forms of Wi-Fi interference on both the 2.4 & 5 GHz bands.
    When streaming, especially HD video on your local network, use wired connections between the host and player devices when possible.
    Other than the above suggestions there are no "magic" settings that you can make on your AirPort. Note: The Guest network shares the same bandwidth as the "main" network. Unless you have a network goal to provide this type of network, it is best left disabled.

  • What are the best practices to use GLOBAL Variables

    Hi,
    Please guide how Global Variables can be declared and how they can be initialized.
    Further please guide what are the impacts of Global Variables(if any) on the memory of CLIENT or SERVER, if they are not initialized or freed up after usage.
    Thanks.
    Regards.

    spilgrim wrote:
    My preference is not to use them and to use parameters or package variables. There is not real control on globals so you can end up with an applicatios that has lots of them that are only used once but persist for the user session.I second that. I don't know how often I searched for bugs caused by typos in the names of global variables. Plus the fact that they are only of datatype VARCHAR2. If you are using share_library_data you could also use Package globals in a forms library to share data between called and calling forms. Or you could use a database package...
    cheers

  • What are the 'gotcha' for exporting using Data Pump(10205) from HPUX to Win

    Hello,
    I have to export a schema using data pump from 10205 on HPUX 64bit to Windows 64bit same 10205 version database. What are the 'gotcha' can I expect from doing this? I mean export data pump is cross platform so this sounds straight forward. But are there issues I might face from export data pump on HPUX platform and then import data dump on to Windows 2008 platform same database version 10205? Thank you in advance.

    On the HPUX database, run this statement and look for the value for NLS_CHARACTERSET
    SQL> select * from NLS_DATABASE_PARAMETERS;http://docs.oracle.com/cd/B19306_01/server.102/b14237/statviews_4218.htm#sthref2018
    When creating the database on Windows, you have two options - manually create the database or use DBCA. If you plan to create the database manually, specify the database characterset in the CREATE DATABASE statement - http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_5004.htm#SQLRF01204
    If using DBCA, see http://docs.oracle.com/cd/B19306_01/server.102/b14196/install.htm#ADMQS0021 (especially http://docs.oracle.com/cd/B19306_01/server.102/b14196/install.htm#BABJBDIF)
    HTH
    Srini

  • What are the best devices to use in my car to listen to music on my 3rd gen iPod Nano?

    What are the best devices on the market today to use in my car to listen to music on my 3rd Gen iPod nano?  I currently use the Monster device that plugs into the electrical adapter (former cigarrette lighter!) in the car.  It's a pain in the neck to manually search for unused FM stations on a long trip. I want something that automatically searches for unsused FM stations or, better yet, that will allow me to somehow connect the iPod into the CD player or directly to the radio itself.  I have a 2004 Toyota Highlander.
    Any suggestions for quality after-market products from the Forum?

    If you have files with the .m4v or .m4a extension its better to change them to .mp4. The M4 extensions will sometimes download in the browser instead of playing.
    A usefull free app for file conversion is Miro...
    http://www.iwebformusicians.com/Website-Movie-Video/Easy-Movie-Player.html
    It can quickly convert to all the formats you need to load for html5 playback: MP4, OGG, WebM
    If you include these three, fallback to flash will only be required for Internet Explorer V 8 and older. V 9 is supposed to support html5 but I haven't actually seen any proof of this.
    Players like flowplayer and JWLongtail are convenient because the control bar icon be customized. This lets you get away from the nasty looking QT control bar.
    http://www.iwebformusicians.com/Website-Movie-Video/JW-Media-Player.html
    http://www.iwebformusicians.com/Website-Movie-Video/Flow-Player.html
    "I may receive some form of compensation, financial or otherwise, from my recommendation or link."

Maybe you are looking for

  • Error in GL a/c document

    Hi, While creating GL a/c document i am getting error message " Partner profit centre locked" Anyone can help me to sort out this issue? Regards R.Sasikumar

  • Unsecured Network problem

    Hello! I have WCG200 Cable Gateway modem-router and use it for about 4 years. The problem is that unfortunately at the time of initial setup I didn't chose an option to Password protect my network and it operates as "Unsecured Network". Fortunately I

  • BAPI_SALESORDER_CREATEFROMDAT2 - Configurating Items

    Hi  everybody!   Now i'm trying to create an order but  configurating some items, i'm testing the BAPI at SE37, when  i test the BAPI it gives me the order number but the configuration in the item WHERE  i SEND the data is not made, I give YOU the pa

  • Document atatchment to PO/PR/RFQ

    Can any body please suggest on can we attach a document to PR or PO or RFQ ?? Buyer prefer attaching a pdf file to quotation if possible, if not at least in PR/PO, If yes please suggest how?

  • Parameters for Opening PDF Files in Version XI

    I have an application that opens a PDF document using Reader Version 7 - 10 at a particular page. In Version XI this feature has been removed or changed and I can't find any documentation on Opening parameters for latest version.