Search in sources :

Example 1 with CaseInsensitiveOrder

use of com.codename1.util.CaseInsensitiveOrder in project CodenameOne by codenameone.

the class StyleParser method getBackgroundTypes.

/**
 * Gets the available background type strings (which can be passed to {@link StyleInfo#setBgType(java.lang.String) }
 * @return
 */
public static List<String> getBackgroundTypes() {
    ArrayList<String> out = new ArrayList<String>();
    out.addAll(bgTypes().keySet());
    Collections.sort(out, new CaseInsensitiveOrder());
    return out;
}
Also used : ArrayList(java.util.ArrayList) CaseInsensitiveOrder(com.codename1.util.CaseInsensitiveOrder)

Example 2 with CaseInsensitiveOrder

use of com.codename1.util.CaseInsensitiveOrder in project CodenameOne by codenameone.

the class Properties method store.

/**
 * Stores the mappings in this {@code Properties} object to {@code out},
 * putting the specified comment at the beginning.
 *
 * @param writer the {@code Writer}
 * @param comment an optional comment to be written, or null
 * @throws IOException
 * @throws ClassCastException if a key or value is not a string
 * @since 1.6
 */
public synchronized void store(Writer writer, String comment) throws IOException {
    if (comment != null && comment.length() > 0) {
        writer.write("#");
        writer.write(comment);
        writer.write("\n");
        writer.write("#");
        writer.write(new Date().toString());
        writer.write("\n");
    }
    StringBuilder sb = new StringBuilder(200);
    ArrayList<String> k = new ArrayList<String>(keySet());
    Collections.sort(k, new CaseInsensitiveOrder());
    for (String key : k) {
        dumpString(sb, key, true);
        sb.append('=');
        dumpString(sb, (String) get(key), false);
        sb.append("\n");
        writer.write(sb.toString());
        sb.setLength(0);
    }
    writer.flush();
}
Also used : ArrayList(java.util.ArrayList) CaseInsensitiveOrder(com.codename1.util.CaseInsensitiveOrder) Date(java.util.Date)

Aggregations

CaseInsensitiveOrder (com.codename1.util.CaseInsensitiveOrder)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)1