Insert into the right place in a sorted MapElement array, and prevent duplicates.
(MapElement<T>[] oldMap, MapElement<T>[] newMap, MapElement<T> newElement)
| 1478 | * Insert into the right place in a sorted MapElement array, and prevent duplicates. |
| 1479 | */ |
| 1480 | private static <T> boolean insertMap(MapElement<T>[] oldMap, MapElement<T>[] newMap, MapElement<T> newElement) { |
| 1481 | int pos = find(oldMap, newElement.name); |
| 1482 | if ((pos != -1) && (newElement.name.equals(oldMap[pos].name))) { |
| 1483 | return false; |
| 1484 | } |
| 1485 | System.arraycopy(oldMap, 0, newMap, 0, pos + 1); |
| 1486 | newMap[pos + 1] = newElement; |
| 1487 | System.arraycopy(oldMap, pos + 1, newMap, pos + 2, oldMap.length - pos - 1); |
| 1488 | return true; |
| 1489 | } |
| 1490 | |
| 1491 | |
| 1492 | /** |
no test coverage detected