Ignore:
Timestamp:
2017-03-03T01:31:34+01:00 (7 years ago)
Author:
Don-vip
Message:

FindBugs - MS_MUTABLE_COLLECTION

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/imagery/OffsetBookmark.java

    r10742 r11651  
    1717
    1818public class OffsetBookmark {
    19     public static final List<OffsetBookmark> allBookmarks = new ArrayList<>();
     19    private static final List<OffsetBookmark> allBookmarks = new ArrayList<>();
    2020
    2121    public String projectionCode;
     
    9494    }
    9595
     96    /**
     97     * Returns all bookmarks.
     98     * @return all bookmarks (unmodifiable collection)
     99     * @since 11651
     100     */
     101    public static List<OffsetBookmark> getBookmarks() {
     102        return Collections.unmodifiableList(allBookmarks);
     103    }
     104
     105    /**
     106     * Returns the number of bookmarks.
     107     * @return the number of bookmarks
     108     * @since 11651
     109     */
     110    public static int getBookmarksSize() {
     111        return allBookmarks.size();
     112    }
     113
     114    /**
     115     * Adds a bookmark.
     116     * @param ob bookmark to add
     117     * @return {@code true}
     118     * @since 11651
     119     */
     120    public static boolean addBookmark(OffsetBookmark ob) {
     121        return allBookmarks.add(ob);
     122    }
     123
     124    /**
     125     * Removes a bookmark.
     126     * @param ob bookmark to remove
     127     * @return {@code true} if this list contained the specified element
     128     * @since 11651
     129     */
     130    public static boolean removeBookmark(OffsetBookmark ob) {
     131        return allBookmarks.remove(ob);
     132    }
     133
     134    /**
     135     * Returns the bookmark at the given index.
     136     * @param index bookmark index
     137     * @return the bookmark at the given index
     138     * @throws IndexOutOfBoundsException if the index is out of range
     139     *         (<tt>index &lt; 0 || index &gt;= size()</tt>)
     140     * @since 11651
     141     */
     142    public static OffsetBookmark getBookmarkByIndex(int index) {
     143        return allBookmarks.get(index);
     144    }
     145
    96146    public static OffsetBookmark getBookmarkByName(ImageryLayer layer, String name) {
    97147        for (OffsetBookmark b : allBookmarks) {
Note: See TracChangeset for help on using the changeset viewer.