< prev index next >

src/com/sun/interview/StringListQuestion.java

Print this page
rev 145 : 7902237: Fixing raw use of parameterized class
Reviewed-by: jjg


 124         StringBuffer sb = new StringBuffer();
 125         for (int i = 0; i < value.length; i++) {
 126             if (sb.length() > 0)
 127                 sb.append('\n');
 128             if (value[i] != null)
 129                 sb.append(value[i]);
 130         }
 131 
 132         return sb.toString();
 133     }
 134 
 135     public boolean isValueValid() {
 136         return true;
 137     }
 138 
 139     public boolean isValueAlwaysValid() {
 140         return false;
 141     }
 142 
 143     public void setValue(String s) {
 144         setValue(s == null ? ((String[]) null) : split(s));
 145     }
 146 
 147     /**
 148      * Set the current value.
 149      * @param newValue The value to be set.
 150      *
 151      * @see #getValue
 152      */
 153     public void setValue(String[] newValue) {
 154         if (newValue != null) {
 155             for (int i = 0; i < newValue.length; i++) {
 156                 if (newValue[i] == null || (newValue[i].indexOf("\n") != -1))
 157                     throw new IllegalArgumentException();
 158             }
 159         }
 160 
 161         if (!equal(newValue, value)) {
 162             if (newValue == null)
 163                 value = null;
 164             else {




 124         StringBuffer sb = new StringBuffer();
 125         for (int i = 0; i < value.length; i++) {
 126             if (sb.length() > 0)
 127                 sb.append('\n');
 128             if (value[i] != null)
 129                 sb.append(value[i]);
 130         }
 131 
 132         return sb.toString();
 133     }
 134 
 135     public boolean isValueValid() {
 136         return true;
 137     }
 138 
 139     public boolean isValueAlwaysValid() {
 140         return false;
 141     }
 142 
 143     public void setValue(String s) {
 144         setValue(s == null ? null : split(s));
 145     }
 146 
 147     /**
 148      * Set the current value.
 149      * @param newValue The value to be set.
 150      *
 151      * @see #getValue
 152      */
 153     public void setValue(String[] newValue) {
 154         if (newValue != null) {
 155             for (int i = 0; i < newValue.length; i++) {
 156                 if (newValue[i] == null || (newValue[i].indexOf("\n") != -1))
 157                     throw new IllegalArgumentException();
 158             }
 159         }
 160 
 161         if (!equal(newValue, value)) {
 162             if (newValue == null)
 163                 value = null;
 164             else {


< prev index next >