Exemplo n.º 1
0
 /**
  * Returns a tag list that has a copy of {@code tags}. Each tag value
  * is expected to be a string parseable using {@link BasicTag#parseTag}.
  */
 public static BasicTagList copyOf(IEnumerable <String> tags)
 {
     SmallTagMap.Builder builder = SmallTagMap.builder();
     foreach (var tag in tags)
     {
         builder.add(Tags.parseTag(tag));
     }
     return(new BasicTagList(builder.result()));
 }
Exemplo n.º 2
0
        /**
         * Returns a tag list that has a copy of {@code tags}.
         */
        public static BasicTagList copyOf(IDictionary <String, String> tags)
        {
            SmallTagMap.Builder builder = SmallTagMap.builder();
            foreach (var tag in tags)
            {
                builder.add(Tags.newTag(tag.Key, tag.Value));
            }

            return(new BasicTagList(builder.result()));
        }
Exemplo n.º 3
0
        /**
         * Returns a tag list from the list of key values passed.
         * <p/>
         * Example:
         * <p/>
         * <code>
         * BasicTagList tagList = BasicTagList.of("id", "someId", "class", "someClass");
         * </code>
         */
        public static BasicTagList of(params string[] tags)
        {
            //Preconditions.checkArgument(tags.Length % 2 == 0, "tags must be a sequence of key,value pairs");

            SmallTagMap.Builder builder = SmallTagMap.builder();
            for (int i = 0; i < tags.Length; i += 2)
            {
                ITag t = Tags.newTag(tags[i], tags[i + 1]);
                builder.add(t);
            }
            return(new BasicTagList(builder.result()));
        }