Package com.jillesvangurp.efficientstring

Examples of com.jillesvangurp.efficientstring.EfficientString


        w.append(JsonSerializer.OPEN_BRACE);

        Iterator<Entry<Integer, JsonElement>> iterator = intMap.entrySet().iterator();
        while (iterator.hasNext()) {
            Entry<Integer, JsonElement> entry = iterator.next();
            EfficientString key = EfficientString.get(entry.getKey());
            JsonElement value = entry.getValue();
            w.append(JsonSerializer.QUOTE);
            w.append(JsonSerializer.jsonEscape(key.toString()));
            w.append(JsonSerializer.QUOTE);
            w.append(JsonSerializer.COLON);
            value.serialize(w);
            if (iterator.hasNext()) {
                w.append(JsonSerializer.COMMA);
View Full Code Here


                        final Entry<Integer, JsonElement> next = it.next();
                        return new Entry<String, JsonElement>() {

                            @Override
                            public String getKey() {
                                EfficientString es = EfficientString.get(next.getKey());
                                return es.toString();
                            }

                            @Override
                            public JsonElement getValue() {
                                return next.getValue();
                            }

                            @Override
                            public JsonElement setValue(JsonElement value) {
                                throw new UnsupportedOperationException("immutable entry");
                            }
                        };
                    }

                    @Override
                    public void remove() {
                        it.remove();
                    }
                };
            }

            @Override
            public boolean remove(Object o) {
                throw new UnsupportedOperationException("entry set is immutable");
            }

            @Override
            public boolean removeAll(Collection<?> c) {
                throw new UnsupportedOperationException("entry set is immutable");
            }

            @Override
            public boolean retainAll(Collection<?> c) {
                throw new UnsupportedOperationException("entry set is immutable");
            }

            @Override
            public int size() {
                return entrySet.size();
            }

            @Override
            public Object[] toArray() {
                @SuppressWarnings("unchecked")
                Entry<String, JsonElement>[] result = new Entry[entrySet.size()];
                int i = 0;
                for (final Entry<Integer, JsonElement> e : entrySet) {
                    result[i] = new Entry<String, JsonElement>() {

                        @Override
                        public String getKey() {
                            EfficientString es = EfficientString.get(e.getKey());
                            return es.toString();
                        }

                        @Override
                        public JsonElement getValue() {
                            return e.getValue();
View Full Code Here

            executorService.execute(new Runnable() {

                @Override
                public void run() {
                    o.put(str, str); // this should never fail with null key because of the (hopefully) now fixed EfficientString
                    EfficientString e = EfficientString.fromString(str);
                    assertThat(EfficientString.fromString(str), is(e));
                }
            });
        }
View Full Code Here

TOP

Related Classes of com.jillesvangurp.efficientstring.EfficientString

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.