Add entry. Removes previous occurencies of the same file. @param entry entry to add
(WorldFileEntry entry)
| 74 | * @param entry entry to add |
| 75 | */ |
| 76 | public static void push(WorldFileEntry entry){ |
| 77 | if(entry != null){ |
| 78 | // remove equal entries |
| 79 | LinkedList<WorldFileEntry> toBeRemoved = new LinkedList<>(); |
| 80 | |
| 81 | for(WorldFileEntry it: worldFileHistory){ |
| 82 | if(it.getFile().equals(entry.getFile())){ |
| 83 | toBeRemoved.push(it); |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | for(WorldFileEntry it: toBeRemoved){ |
| 88 | worldFileHistory.remove(it); |
| 89 | } |
| 90 | |
| 91 | // insert entry |
| 92 | worldFileHistory.push(entry); |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * Get entry by file |