Example usage for org.apache.commons.collections4.map ListOrderedMap ListOrderedMap

List of usage examples for org.apache.commons.collections4.map ListOrderedMap ListOrderedMap

Introduction

In this page you can find the example usage for org.apache.commons.collections4.map ListOrderedMap ListOrderedMap.

Prototype

public ListOrderedMap() 

Source Link

Document

Constructs a new empty ListOrderedMap that decorates a HashMap.

Usage

From source file:com.dreamfactory.kurtishu.pretty.view.delegate.AboutDelegate.java

@Override
protected void initViews(Context context, Intent mIntent) {
    super.initViews(context, mIntent);
    Toolbar toolbar = get(R.id.toolbar);
    toolbar.setTitle(R.string.app_name);
    toolbar.setTitleTextColor(Color.WHITE);
    toolbar.setNavigationIcon(R.mipmap.ic_arrow_back);
    toolbar.setNavigationOnClickListener(this);

    TextView textViewVersion = get(R.id.version);
    textViewVersion.setText(context.getString(R.string.version, BuildConfig.VERSION_NAME, BuildConfig.FLAVOR));

    RecyclerView mRecyclerView = get(R.id.dp_libraries);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(context));

    ListOrderedMap<String, String> dataMap = new ListOrderedMap<String, String>();
    dataMap.put("GitHub?", "https://github.com/KurtisHu/Pretty");
    dataMap.put("  ", " ?");
    dataMap.put("square / okhttp", "https://square.github.io/okhttp/");
    dataMap.put("google / gson", "https://github.com/google/gson");
    dataMap.put("facebook / fresco", "https://github.com/facebook/fresco");
    dataMap.put("orhanobut / logger", "https://github.com/orhanobut/logger");
    dataMap.put("greenrobot / EventBus", "https://github.com/greenrobot/EventBus");
    dataMap.put("lsjwzh / RecyclerViewPager", "https://github.com/lsjwzh/RecyclerViewPager");
    dataMap.put("Syehunter / RecyclerViewManager", "https://github.com/Syehunter/RecyclerViewManager");
    dataMap.put("Apache / commons-collections", "http://commons.apache.org/proper/commons-collections/");
    dataMap.put("Realm", "https://realm.io");

    mRecyclerView.setAdapter(new LibraryAdapter(context, dataMap));
}

From source file:com.norconex.commons.lang.url.QueryString.java

/**
 * Constructor.  /*from  w w  w  .  j  a va  2 s  .  c o  m*/
 * It is possible to only supply a query string as opposed to an
 * entire URL.
 * Key and values making up a query string are assumed to be URL-encoded.
 * Will throw a {@link URLException} if the supplied encoding is 
 * unsupported or invalid.
 * @param urlWithQueryString a URL from which to extract a query string.
 * @param encoding character encoding
 */
public QueryString(String urlWithQueryString, String encoding) {
    super(new ListOrderedMap<String, List<String>>());
    if (StringUtils.isBlank(encoding)) {
        this.encoding = CharEncoding.UTF_8;
    } else {
        this.encoding = encoding;
    }
    String paramString = urlWithQueryString;
    if (StringUtils.contains(paramString, "?")) {
        paramString = paramString.replaceAll("(.*?)(\\?)(.*)", "$3");
    }
    String[] paramParts = paramString.split("\\&");
    for (int i = 0; i < paramParts.length; i++) {
        String paramPart = paramParts[i];
        if (StringUtils.contains(paramPart, "=")) {
            String key = StringUtils.substringBefore(paramPart, "=");
            String value = StringUtils.substringAfter(paramPart, "=");
            try {
                addString(URLDecoder.decode(key, this.encoding), URLDecoder.decode(value, this.encoding));
            } catch (UnsupportedEncodingException e) {
                throw new URLException("Cannot URL-decode query string (key=" + key + "; value=" + value + ").",
                        e);
            }
        }
    }
}

From source file:com.kantenkugel.discordbot.jdocparser.JDocParser.java

private static List<DocBlock> getDocBlock(String jdocBase, Element elem, ClassDocumentation reference) {
    if (elem != null) {
        String baseLink = JDocUtil.getLink(jdocBase, reference);
        List<DocBlock> blocks = new ArrayList<>(10);
        String hashLink = null;/*from  w  ww . ja v  a  2 s  . c om*/
        for (elem = elem.nextElementSibling(); elem != null; elem = elem.nextElementSibling()) {
            if (elem.tagName().equals("a")) {
                hashLink = '#' + elem.attr("name");
            } else if (elem.tagName().equals("ul")) {
                Element tmp = elem.getElementsByTag("h4").first();
                String title = JDocUtil.fixSpaces(tmp.text().trim());
                String description = "", signature = "";
                OrderedMap<String, List<String>> fields = new ListOrderedMap<>();
                for (; tmp != null; tmp = tmp.nextElementSibling()) {
                    if (tmp.tagName().equals("pre")) {
                        //contains full signature
                        signature = JDocUtil.fixSpaces(tmp.text().trim());
                    } else if (tmp.tagName().equals("div") && tmp.className().equals("block")) {
                        //main block of content (description or deprecation)
                        Element deprecationElem = tmp.getElementsByClass("deprecationComment").first();
                        if (deprecationElem != null) {
                            //deprecation block
                            fields.put("Deprecated:", Collections
                                    .singletonList(JDocUtil.formatText(deprecationElem.html(), baseLink)));
                        } else {
                            //description block
                            description = JDocUtil.formatText(tmp.html(), baseLink);
                        }
                    } else if (tmp.tagName().equals("dl")) {
                        //a field
                        String fieldName = null;
                        List<String> fieldValues = new ArrayList<>();
                        for (Element element : tmp.children()) {
                            if (element.tagName().equals("dt")) {
                                if (fieldName != null) {
                                    fields.put(fieldName, fieldValues);
                                    fieldValues = new ArrayList<>();
                                }
                                fieldName = JDocUtil.fixSpaces(element.text().trim());
                            } else if (element.tagName().equals("dd")) {
                                fieldValues.add(JDocUtil.formatText(element.html(), baseLink));
                            }
                        }
                        if (fieldName != null) {
                            fields.put(fieldName, fieldValues);
                        }
                    }
                }
                blocks.add(new DocBlock(title, hashLink, signature, description, fields));
            }
        }
        return blocks;
    }
    return null;
}