/** * Let {@link FileAnnotation}s share some of their internal data structure * to reduce memory footprint. * * @param annotations * the annotations to compress * @return The same object as passed in the 'annotations' parameter to let * this function used as a filter. */ protected Collection<FileAnnotation> intern(final Collection<FileAnnotation> annotations) { return AbstractAnnotation.intern(annotations); }
/** * Let {@link FileAnnotation}s share some of their internal data structure * to reduce memory footprint. * * @param annotations * the annotations to compress * @return The same object as passed in the 'annotations' parameter to let * this function used as a filter. */ protected Collection<FileAnnotation> intern(final Collection<FileAnnotation> annotations) { return AbstractAnnotation.intern(annotations); }
/** * Let {@link FileAnnotation}s share some of their internal data structure * to reduce memory footprint. * * @param annotations * the annotations to compress * @return The same object as passed in the 'annotations' parameter to let * this function used as a filter. */ public static Collection<FileAnnotation> intern(final Collection<FileAnnotation> annotations) { TreeStringBuilder stringPool = new TreeStringBuilder(); for (FileAnnotation annotation : annotations) { if (annotation instanceof AbstractAnnotation) { AbstractAnnotation aa = (AbstractAnnotation) annotation; aa.intern(stringPool); } } stringPool.dedup(); return annotations; }
/** * Let {@link FileAnnotation}s share some of their internal data structure * to reduce memory footprint. * * @param annotations * the annotations to compress * @return The same object as passed in the 'annotations' parameter to let * this function used as a filter. */ public static Collection<FileAnnotation> intern(final Collection<FileAnnotation> annotations) { TreeStringBuilder stringPool = new TreeStringBuilder(); for (FileAnnotation annotation : annotations) { if (annotation instanceof AbstractAnnotation) { AbstractAnnotation aa = (AbstractAnnotation) annotation; aa.intern(stringPool); } } stringPool.dedup(); return annotations; }