jdk/src/share/classes/sun/management/LazyCompositeData.java
changeset 11530 a9d059c15b80
parent 5506 202f599c92aa
child 14342 8435a30053c1
equal deleted inserted replaced
11529:e08d565262ce 11530:a9d059c15b80
    79     public String toString() {
    79     public String toString() {
    80         /** FIXME: What should this be?? */
    80         /** FIXME: What should this be?? */
    81         return compositeData().toString();
    81         return compositeData().toString();
    82     }
    82     }
    83 
    83 
    84     public Collection values() {
    84     public Collection<?> values() {
    85         return compositeData().values();
    85         return compositeData().values();
    86     }
    86     }
    87 
    87 
    88     /* Lazy creation of a CompositeData object
    88     /* Lazy creation of a CompositeData object
    89      * only when the CompositeData interface is used.
    89      * only when the CompositeData interface is used.
   151     protected static boolean isTypeMatched(CompositeType type1, CompositeType type2) {
   151     protected static boolean isTypeMatched(CompositeType type1, CompositeType type2) {
   152         if (type1 == type2) return true;
   152         if (type1 == type2) return true;
   153 
   153 
   154         // We can't use CompositeType.isValue() since it returns false
   154         // We can't use CompositeType.isValue() since it returns false
   155         // if the type name doesn't match.
   155         // if the type name doesn't match.
   156         Set allItems = type1.keySet();
   156         Set<String> allItems = type1.keySet();
   157 
   157 
   158         // Check all items in the type1 exist in type2
   158         // Check all items in the type1 exist in type2
   159         if (!type2.keySet().containsAll(allItems))
   159         if (!type2.keySet().containsAll(allItems))
   160             return false;
   160             return false;
   161 
   161 
   162         for (Iterator iter = allItems.iterator(); iter.hasNext(); ) {
   162         for (String item: allItems) {
   163             String item = (String) iter.next();
   163             OpenType<?> ot1 = type1.getType(item);
   164             OpenType ot1 = type1.getType(item);
   164             OpenType<?> ot2 = type2.getType(item);
   165             OpenType ot2 = type2.getType(item);
       
   166             if (ot1 instanceof CompositeType) {
   165             if (ot1 instanceof CompositeType) {
   167                 if (! (ot2 instanceof CompositeType))
   166                 if (! (ot2 instanceof CompositeType))
   168                     return false;
   167                     return false;
   169                 if (!isTypeMatched((CompositeType) ot1, (CompositeType) ot2))
   168                 if (!isTypeMatched((CompositeType) ot1, (CompositeType) ot2))
   170                     return false;
   169                     return false;
   181     }
   180     }
   182 
   181 
   183     protected static boolean isTypeMatched(TabularType type1, TabularType type2) {
   182     protected static boolean isTypeMatched(TabularType type1, TabularType type2) {
   184         if (type1 == type2) return true;
   183         if (type1 == type2) return true;
   185 
   184 
   186         List list1 = type1.getIndexNames();
   185         List<String> list1 = type1.getIndexNames();
   187         List list2 = type2.getIndexNames();
   186         List<String> list2 = type2.getIndexNames();
   188 
   187 
   189         // check if the list of index names are the same
   188         // check if the list of index names are the same
   190         if (!list1.equals(list2))
   189         if (!list1.equals(list2))
   191             return false;
   190             return false;
   192 
   191