> Jan> oh, I didn't know that these method invocations are faster. But I prefer
> Jan> a more generalized code style. Ok it's a private field so this may be no
> Jan> problem in this case. 
> Jan> But are there any other opinions on that or is this somewhere defined in
> Jan> a GNU/Classpath Code style?
> 
> AFAIK it isn't a defined style.
> 
> I have a slight preference for the more specific declaration.  For
> private fields (and local variables) this doesn't hurt clarity or
> maintainability, particularly if you do future refactorings with a
> tool like eclipse.  And, it provides a small performance benefit.

Ok, I changed that together with some minor codestyle fixes in the
following patch:

2005-11-30  Jan Roehrich  <[EMAIL PROTECTED]>

        * java/awt/datatransfer/SystemFlavorMap.java
        Some minor codestyle fixes.
        (nativeToFlavorMap): removed generalization.
        (flavorToNativeMap): likewise.
Index: SystemFlavorMap.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/datatransfer/SystemFlavorMap.java,v
retrieving revision 1.8
diff -u -r1.8 SystemFlavorMap.java
--- SystemFlavorMap.java	28 Nov 2005 23:33:47 -0000	1.8
+++ SystemFlavorMap.java	30 Nov 2005 00:55:18 -0000
@@ -65,13 +65,13 @@
    * This map maps native <code>String</code>s to lists of 
    * <code>DataFlavor</code>s
    */
-  private Map nativeToFlavorMap = new HashMap();
+  private HashMap nativeToFlavorMap = new HashMap();
   
   /**
    * This map maps <code>DataFlavor</code>s to lists of native 
    * <code>String</code>s
    */
-  private Map flavorToNativeMap = new HashMap();
+  private HashMap flavorToNativeMap = new HashMap();
 
   /**
    * Private constructor.
@@ -122,7 +122,7 @@
         .getContextClassLoader();
     
     //if ContextClassLoader not set, use system default 
-    if(classLoader == null)
+    if (classLoader == null)
       {
         classLoader = ClassLoader.getSystemClassLoader();
       }
@@ -131,7 +131,7 @@
       {
         FlavorMap map = (FlavorMap) 
             systemFlavorMaps.get(classLoader);
-        if(map == null) 
+        if (map == null) 
           {
             map = new SystemFlavorMap();
             systemFlavorMaps.put(classLoader, map);
@@ -219,17 +219,17 @@
   public synchronized void addFlavorForUnencodedNative(String nativeStr, 
                                                        DataFlavor flavor)
   {
-    if((nativeStr == null) || (flavor == null))
+    if ((nativeStr == null) || (flavor == null))
       throw new NullPointerException();
     List flavors = (List) nativeToFlavorMap.get(nativeStr);
-    if(flavors == null) 
+    if (flavors == null) 
       {
         flavors = new ArrayList();
         nativeToFlavorMap.put(nativeStr, flavors);
       }
     else
       {
-        if(!flavors.contains(flavor))
+        if (! flavors.contains(flavor))
           flavors.add(flavor);
       }
   }
@@ -257,17 +257,17 @@
   public synchronized void addUnencodedNativeForFlavor(DataFlavor flavor,
                                                        String nativeStr) 
   {
-    if((nativeStr == null) || (flavor == null))
+    if ((nativeStr == null) || (flavor == null))
       throw new NullPointerException();
     List natives = (List) flavorToNativeMap.get(flavor);
-    if(natives == null) 
+    if (natives == null) 
       {
         natives = new ArrayList();
         flavorToNativeMap.put(flavor, natives);
       }
     else
       {
-        if(!natives.contains(nativeStr))
+        if (! natives.contains(nativeStr))
           natives.add(nativeStr);
       }
   }
@@ -303,11 +303,11 @@
   public synchronized void setNativesForFlavor(DataFlavor flavor,
                                                String[] natives) 
   {
-    if((natives == null) || (flavor == null))
+    if ((natives == null) || (flavor == null))
       throw new NullPointerException();
     
     flavorToNativeMap.remove(flavor);
-    for(int i = 0; i < natives.length; i++) 
+    for (int i = 0; i < natives.length; i++) 
       {
         addUnencodedNativeForFlavor(flavor, natives[i]);
       }
@@ -343,11 +343,11 @@
   public synchronized void setFlavorsForNative(String nativeStr,
                                                DataFlavor[] flavors) 
   {
-    if((nativeStr == null) || (flavors == null))
+    if ((nativeStr == null) || (flavors == null))
       throw new NullPointerException();
     
     nativeToFlavorMap.remove(nativeStr);
-    for(int i = 0; i < flavors.length; i++) 
+    for (int i = 0; i < flavors.length; i++) 
       {
         addFlavorForUnencodedNative(nativeStr, flavors[i]);
       }

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to