public static List<String> internStringsInList(List<String> list) {
    if (list != null) {
      try {
        ListIterator<String> it = list.listIterator();
        while (it.hasNext()) {
          String curr = it.next();
          // Intern values only when they are not part of the String pool already
          if (curr != curr.intern()) {
            it.set(curr.intern());
          }
        }
      } catch (UnsupportedOperationException e) { } // set() not implemented - ignore
    }
    return list;
  }
This method interns all the strings in the given list in place. That is,
it iterates over the list, checks if each string element is already interned,
and if not it replaces each element with the interned copy.
Eventually returns the same list.

Note that the provided List implementation should return an iterator
(via list.listIterator()) method, and that iterator should implement
the set(Object) method. That's what all List implementations in the JDK
provide. However, if some custom List implementation doesn't have this
functionality, this method will return without interning its elements.
common/src/java/org/apache/hadoop/hive/common/StringInternUtils.java