001/* 002 * Copyright (C) 2009 The Guava Authors 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package com.google.common.collect; 018 019import static com.google.common.base.Preconditions.checkArgument; 020import static com.google.common.base.Preconditions.checkElementIndex; 021import static com.google.common.base.Preconditions.checkNotNull; 022 023import com.google.common.annotations.Beta; 024import com.google.common.annotations.GwtCompatible; 025import com.google.common.annotations.GwtIncompatible; 026import com.google.common.base.Objects; 027import com.google.common.collect.Maps.IteratorBasedAbstractMap; 028import com.google.errorprone.annotations.CanIgnoreReturnValue; 029import com.google.j2objc.annotations.WeakOuter; 030import java.io.Serializable; 031import java.lang.reflect.Array; 032import java.util.Arrays; 033import java.util.Collection; 034import java.util.Iterator; 035import java.util.Map; 036import java.util.Map.Entry; 037import java.util.Set; 038import javax.annotation.Nullable; 039 040/** 041 * Fixed-size {@link Table} implementation backed by a two-dimensional array. 042 * 043 * <p>The allowed row and column keys must be supplied when the table is 044 * created. The table always contains a mapping for every row key / column pair. 045 * The value corresponding to a given row and column is null unless another 046 * value is provided. 047 * 048 * <p>The table's size is constant: the product of the number of supplied row 049 * keys and the number of supplied column keys. The {@code remove} and {@code 050 * clear} methods are not supported by the table or its views. The {@link 051 * #erase} and {@link #eraseAll} methods may be used instead. 052 * 053 * <p>The ordering of the row and column keys provided when the table is 054 * constructed determines the iteration ordering across rows and columns in the 055 * table's views. None of the view iterators support {@link Iterator#remove}. 056 * If the table is modified after an iterator is created, the iterator remains 057 * valid. 058 * 059 * <p>This class requires less memory than the {@link HashBasedTable} and {@link 060 * TreeBasedTable} implementations, except when the table is sparse. 061 * 062 * <p>Null row keys or column keys are not permitted. 063 * 064 * <p>This class provides methods involving the underlying array structure, 065 * where the array indices correspond to the position of a row or column in the 066 * lists of allowed keys and values. See the {@link #at}, {@link #set}, {@link 067 * #toArray}, {@link #rowKeyList}, and {@link #columnKeyList} methods for more 068 * details. 069 * 070 * <p>Note that this implementation is not synchronized. If multiple threads 071 * access the same cell of an {@code ArrayTable} concurrently and one of the 072 * threads modifies its value, there is no guarantee that the new value will be 073 * fully visible to the other threads. To guarantee that modifications are 074 * visible, synchronize access to the table. Unlike other {@code Table} 075 * implementations, synchronization is unnecessary between a thread that writes 076 * to one cell and a thread that reads from another. 077 * 078 * <p>See the Guava User Guide article on <a href= 079 * "https://github.com/google/guava/wiki/NewCollectionTypesExplained#table"> 080 * {@code Table}</a>. 081 * 082 * @author Jared Levy 083 * @since 10.0 084 */ 085@Beta 086@GwtCompatible(emulated = true) 087public final class ArrayTable<R, C, V> extends AbstractTable<R, C, V> implements Serializable { 088 089 /** 090 * Creates an empty {@code ArrayTable}. 091 * 092 * @param rowKeys row keys that may be stored in the generated table 093 * @param columnKeys column keys that may be stored in the generated table 094 * @throws NullPointerException if any of the provided keys is null 095 * @throws IllegalArgumentException if {@code rowKeys} or {@code columnKeys} 096 * contains duplicates or is empty 097 */ 098 public static <R, C, V> ArrayTable<R, C, V> create( 099 Iterable<? extends R> rowKeys, Iterable<? extends C> columnKeys) { 100 return new ArrayTable<R, C, V>(rowKeys, columnKeys); 101 } 102 103 /* 104 * TODO(jlevy): Add factory methods taking an Enum class, instead of an 105 * iterable, to specify the allowed row keys and/or column keys. Note that 106 * custom serialization logic is needed to support different enum sizes during 107 * serialization and deserialization. 108 */ 109 110 /** 111 * Creates an {@code ArrayTable} with the mappings in the provided table. 112 * 113 * <p>If {@code table} includes a mapping with row key {@code r} and a 114 * separate mapping with column key {@code c}, the returned table contains a 115 * mapping with row key {@code r} and column key {@code c}. If that row key / 116 * column key pair in not in {@code table}, the pair maps to {@code null} in 117 * the generated table. 118 * 119 * <p>The returned table allows subsequent {@code put} calls with the row keys 120 * in {@code table.rowKeySet()} and the column keys in {@code 121 * table.columnKeySet()}. Calling {@link #put} with other keys leads to an 122 * {@code IllegalArgumentException}. 123 * 124 * <p>The ordering of {@code table.rowKeySet()} and {@code 125 * table.columnKeySet()} determines the row and column iteration ordering of 126 * the returned table. 127 * 128 * @throws NullPointerException if {@code table} has a null key 129 * @throws IllegalArgumentException if the provided table is empty 130 */ 131 public static <R, C, V> ArrayTable<R, C, V> create(Table<R, C, V> table) { 132 return (table instanceof ArrayTable<?, ?, ?>) 133 ? new ArrayTable<R, C, V>((ArrayTable<R, C, V>) table) 134 : new ArrayTable<R, C, V>(table); 135 } 136 137 private final ImmutableList<R> rowList; 138 private final ImmutableList<C> columnList; 139 140 // TODO(jlevy): Add getters returning rowKeyToIndex and columnKeyToIndex? 141 private final ImmutableMap<R, Integer> rowKeyToIndex; 142 private final ImmutableMap<C, Integer> columnKeyToIndex; 143 private final V[][] array; 144 145 private ArrayTable(Iterable<? extends R> rowKeys, Iterable<? extends C> columnKeys) { 146 this.rowList = ImmutableList.copyOf(rowKeys); 147 this.columnList = ImmutableList.copyOf(columnKeys); 148 checkArgument(!rowList.isEmpty()); 149 checkArgument(!columnList.isEmpty()); 150 151 /* 152 * TODO(jlevy): Support empty rowKeys or columnKeys? If we do, when 153 * columnKeys is empty but rowKeys isn't, the table is empty but 154 * containsRow() can return true and rowKeySet() isn't empty. 155 */ 156 rowKeyToIndex = Maps.indexMap(rowList); 157 columnKeyToIndex = Maps.indexMap(columnList); 158 159 @SuppressWarnings("unchecked") 160 V[][] tmpArray = (V[][]) new Object[rowList.size()][columnList.size()]; 161 array = tmpArray; 162 // Necessary because in GWT the arrays are initialized with "undefined" instead of null. 163 eraseAll(); 164 } 165 166 private ArrayTable(Table<R, C, V> table) { 167 this(table.rowKeySet(), table.columnKeySet()); 168 putAll(table); 169 } 170 171 private ArrayTable(ArrayTable<R, C, V> table) { 172 rowList = table.rowList; 173 columnList = table.columnList; 174 rowKeyToIndex = table.rowKeyToIndex; 175 columnKeyToIndex = table.columnKeyToIndex; 176 @SuppressWarnings("unchecked") 177 V[][] copy = (V[][]) new Object[rowList.size()][columnList.size()]; 178 array = copy; 179 // Necessary because in GWT the arrays are initialized with "undefined" instead of null. 180 eraseAll(); 181 for (int i = 0; i < rowList.size(); i++) { 182 System.arraycopy(table.array[i], 0, copy[i], 0, table.array[i].length); 183 } 184 } 185 186 private abstract static class ArrayMap<K, V> extends IteratorBasedAbstractMap<K, V> { 187 private final ImmutableMap<K, Integer> keyIndex; 188 189 private ArrayMap(ImmutableMap<K, Integer> keyIndex) { 190 this.keyIndex = keyIndex; 191 } 192 193 @Override 194 public Set<K> keySet() { 195 return keyIndex.keySet(); 196 } 197 198 K getKey(int index) { 199 return keyIndex.keySet().asList().get(index); 200 } 201 202 abstract String getKeyRole(); 203 204 @Nullable 205 abstract V getValue(int index); 206 207 @Nullable 208 abstract V setValue(int index, V newValue); 209 210 @Override 211 public int size() { 212 return keyIndex.size(); 213 } 214 215 @Override 216 public boolean isEmpty() { 217 return keyIndex.isEmpty(); 218 } 219 220 @Override 221 Iterator<Entry<K, V>> entryIterator() { 222 return new AbstractIndexedListIterator<Entry<K, V>>(size()) { 223 @Override 224 protected Entry<K, V> get(final int index) { 225 return new AbstractMapEntry<K, V>() { 226 @Override 227 public K getKey() { 228 return ArrayMap.this.getKey(index); 229 } 230 231 @Override 232 public V getValue() { 233 return ArrayMap.this.getValue(index); 234 } 235 236 @Override 237 public V setValue(V value) { 238 return ArrayMap.this.setValue(index, value); 239 } 240 }; 241 } 242 }; 243 } 244 245 // TODO(lowasser): consider an optimized values() implementation 246 247 @Override 248 public boolean containsKey(@Nullable Object key) { 249 return keyIndex.containsKey(key); 250 } 251 252 @Override 253 public V get(@Nullable Object key) { 254 Integer index = keyIndex.get(key); 255 if (index == null) { 256 return null; 257 } else { 258 return getValue(index); 259 } 260 } 261 262 @Override 263 public V put(K key, V value) { 264 Integer index = keyIndex.get(key); 265 if (index == null) { 266 throw new IllegalArgumentException( 267 getKeyRole() + " " + key + " not in " + keyIndex.keySet()); 268 } 269 return setValue(index, value); 270 } 271 272 @Override 273 public V remove(Object key) { 274 throw new UnsupportedOperationException(); 275 } 276 277 @Override 278 public void clear() { 279 throw new UnsupportedOperationException(); 280 } 281 } 282 283 /** 284 * Returns, as an immutable list, the row keys provided when the table was 285 * constructed, including those that are mapped to null values only. 286 */ 287 public ImmutableList<R> rowKeyList() { 288 return rowList; 289 } 290 291 /** 292 * Returns, as an immutable list, the column keys provided when the table was 293 * constructed, including those that are mapped to null values only. 294 */ 295 public ImmutableList<C> columnKeyList() { 296 return columnList; 297 } 298 299 /** 300 * Returns the value corresponding to the specified row and column indices. 301 * The same value is returned by {@code 302 * get(rowKeyList().get(rowIndex), columnKeyList().get(columnIndex))}, but 303 * this method runs more quickly. 304 * 305 * @param rowIndex position of the row key in {@link #rowKeyList()} 306 * @param columnIndex position of the row key in {@link #columnKeyList()} 307 * @return the value with the specified row and column 308 * @throws IndexOutOfBoundsException if either index is negative, {@code 309 * rowIndex} is greater then or equal to the number of allowed row keys, 310 * or {@code columnIndex} is greater then or equal to the number of 311 * allowed column keys 312 */ 313 public V at(int rowIndex, int columnIndex) { 314 // In GWT array access never throws IndexOutOfBoundsException. 315 checkElementIndex(rowIndex, rowList.size()); 316 checkElementIndex(columnIndex, columnList.size()); 317 return array[rowIndex][columnIndex]; 318 } 319 320 /** 321 * Associates {@code value} with the specified row and column indices. The 322 * logic {@code 323 * put(rowKeyList().get(rowIndex), columnKeyList().get(columnIndex), value)} 324 * has the same behavior, but this method runs more quickly. 325 * 326 * @param rowIndex position of the row key in {@link #rowKeyList()} 327 * @param columnIndex position of the row key in {@link #columnKeyList()} 328 * @param value value to store in the table 329 * @return the previous value with the specified row and column 330 * @throws IndexOutOfBoundsException if either index is negative, {@code 331 * rowIndex} is greater then or equal to the number of allowed row keys, 332 * or {@code columnIndex} is greater then or equal to the number of 333 * allowed column keys 334 */ 335 @CanIgnoreReturnValue 336 public V set(int rowIndex, int columnIndex, @Nullable V value) { 337 // In GWT array access never throws IndexOutOfBoundsException. 338 checkElementIndex(rowIndex, rowList.size()); 339 checkElementIndex(columnIndex, columnList.size()); 340 V oldValue = array[rowIndex][columnIndex]; 341 array[rowIndex][columnIndex] = value; 342 return oldValue; 343 } 344 345 /** 346 * Returns a two-dimensional array with the table contents. The row and column 347 * indices correspond to the positions of the row and column in the iterables 348 * provided during table construction. If the table lacks a mapping for a 349 * given row and column, the corresponding array element is null. 350 * 351 * <p>Subsequent table changes will not modify the array, and vice versa. 352 * 353 * @param valueClass class of values stored in the returned array 354 */ 355 @GwtIncompatible // reflection 356 public V[][] toArray(Class<V> valueClass) { 357 @SuppressWarnings("unchecked") // TODO: safe? 358 V[][] copy = (V[][]) Array.newInstance(valueClass, rowList.size(), columnList.size()); 359 for (int i = 0; i < rowList.size(); i++) { 360 System.arraycopy(array[i], 0, copy[i], 0, array[i].length); 361 } 362 return copy; 363 } 364 365 /** 366 * Not supported. Use {@link #eraseAll} instead. 367 * 368 * @throws UnsupportedOperationException always 369 * @deprecated Use {@link #eraseAll} 370 */ 371 @Override 372 @Deprecated 373 public void clear() { 374 throw new UnsupportedOperationException(); 375 } 376 377 /** 378 * Associates the value {@code null} with every pair of allowed row and column 379 * keys. 380 */ 381 public void eraseAll() { 382 for (V[] row : array) { 383 Arrays.fill(row, null); 384 } 385 } 386 387 /** 388 * Returns {@code true} if the provided keys are among the keys provided when 389 * the table was constructed. 390 */ 391 @Override 392 public boolean contains(@Nullable Object rowKey, @Nullable Object columnKey) { 393 return containsRow(rowKey) && containsColumn(columnKey); 394 } 395 396 /** 397 * Returns {@code true} if the provided column key is among the column keys 398 * provided when the table was constructed. 399 */ 400 @Override 401 public boolean containsColumn(@Nullable Object columnKey) { 402 return columnKeyToIndex.containsKey(columnKey); 403 } 404 405 /** 406 * Returns {@code true} if the provided row key is among the row keys 407 * provided when the table was constructed. 408 */ 409 @Override 410 public boolean containsRow(@Nullable Object rowKey) { 411 return rowKeyToIndex.containsKey(rowKey); 412 } 413 414 @Override 415 public boolean containsValue(@Nullable Object value) { 416 for (V[] row : array) { 417 for (V element : row) { 418 if (Objects.equal(value, element)) { 419 return true; 420 } 421 } 422 } 423 return false; 424 } 425 426 @Override 427 public V get(@Nullable Object rowKey, @Nullable Object columnKey) { 428 Integer rowIndex = rowKeyToIndex.get(rowKey); 429 Integer columnIndex = columnKeyToIndex.get(columnKey); 430 return (rowIndex == null || columnIndex == null) ? null : at(rowIndex, columnIndex); 431 } 432 433 /** 434 * Always returns {@code false}. 435 */ 436 @Override 437 public boolean isEmpty() { 438 return false; 439 } 440 441 /** 442 * {@inheritDoc} 443 * 444 * @throws IllegalArgumentException if {@code rowKey} is not in {@link 445 * #rowKeySet()} or {@code columnKey} is not in {@link #columnKeySet()}. 446 */ 447 @CanIgnoreReturnValue 448 @Override 449 public V put(R rowKey, C columnKey, @Nullable V value) { 450 checkNotNull(rowKey); 451 checkNotNull(columnKey); 452 Integer rowIndex = rowKeyToIndex.get(rowKey); 453 checkArgument(rowIndex != null, "Row %s not in %s", rowKey, rowList); 454 Integer columnIndex = columnKeyToIndex.get(columnKey); 455 checkArgument(columnIndex != null, "Column %s not in %s", columnKey, columnList); 456 return set(rowIndex, columnIndex, value); 457 } 458 459 /* 460 * TODO(jlevy): Consider creating a merge() method, similar to putAll() but 461 * copying non-null values only. 462 */ 463 464 /** 465 * {@inheritDoc} 466 * 467 * <p>If {@code table} is an {@code ArrayTable}, its null values will be 468 * stored in this table, possibly replacing values that were previously 469 * non-null. 470 * 471 * @throws NullPointerException if {@code table} has a null key 472 * @throws IllegalArgumentException if any of the provided table's row keys or 473 * column keys is not in {@link #rowKeySet()} or {@link #columnKeySet()} 474 */ 475 @Override 476 public void putAll(Table<? extends R, ? extends C, ? extends V> table) { 477 super.putAll(table); 478 } 479 480 /** 481 * Not supported. Use {@link #erase} instead. 482 * 483 * @throws UnsupportedOperationException always 484 * @deprecated Use {@link #erase} 485 */ 486 @CanIgnoreReturnValue 487 @Override 488 @Deprecated 489 public V remove(Object rowKey, Object columnKey) { 490 throw new UnsupportedOperationException(); 491 } 492 493 /** 494 * Associates the value {@code null} with the specified keys, assuming both 495 * keys are valid. If either key is null or isn't among the keys provided 496 * during construction, this method has no effect. 497 * 498 * <p>This method is equivalent to {@code put(rowKey, columnKey, null)} when 499 * both provided keys are valid. 500 * 501 * @param rowKey row key of mapping to be erased 502 * @param columnKey column key of mapping to be erased 503 * @return the value previously associated with the keys, or {@code null} if 504 * no mapping existed for the keys 505 */ 506 @CanIgnoreReturnValue 507 public V erase(@Nullable Object rowKey, @Nullable Object columnKey) { 508 Integer rowIndex = rowKeyToIndex.get(rowKey); 509 Integer columnIndex = columnKeyToIndex.get(columnKey); 510 if (rowIndex == null || columnIndex == null) { 511 return null; 512 } 513 return set(rowIndex, columnIndex, null); 514 } 515 516 // TODO(jlevy): Add eraseRow and eraseColumn methods? 517 518 @Override 519 public int size() { 520 return rowList.size() * columnList.size(); 521 } 522 523 /** 524 * Returns an unmodifiable set of all row key / column key / value 525 * triplets. Changes to the table will update the returned set. 526 * 527 * <p>The returned set's iterator traverses the mappings with the first row 528 * key, the mappings with the second row key, and so on. 529 * 530 * <p>The value in the returned cells may change if the table subsequently 531 * changes. 532 * 533 * @return set of table cells consisting of row key / column key / value 534 * triplets 535 */ 536 @Override 537 public Set<Cell<R, C, V>> cellSet() { 538 return super.cellSet(); 539 } 540 541 @Override 542 Iterator<Cell<R, C, V>> cellIterator() { 543 return new AbstractIndexedListIterator<Cell<R, C, V>>(size()) { 544 @Override 545 protected Cell<R, C, V> get(final int index) { 546 return new Tables.AbstractCell<R, C, V>() { 547 final int rowIndex = index / columnList.size(); 548 final int columnIndex = index % columnList.size(); 549 550 @Override 551 public R getRowKey() { 552 return rowList.get(rowIndex); 553 } 554 555 @Override 556 public C getColumnKey() { 557 return columnList.get(columnIndex); 558 } 559 560 @Override 561 public V getValue() { 562 return at(rowIndex, columnIndex); 563 } 564 }; 565 } 566 }; 567 } 568 569 /** 570 * Returns a view of all mappings that have the given column key. If the 571 * column key isn't in {@link #columnKeySet()}, an empty immutable map is 572 * returned. 573 * 574 * <p>Otherwise, for each row key in {@link #rowKeySet()}, the returned map 575 * associates the row key with the corresponding value in the table. Changes 576 * to the returned map will update the underlying table, and vice versa. 577 * 578 * @param columnKey key of column to search for in the table 579 * @return the corresponding map from row keys to values 580 */ 581 @Override 582 public Map<R, V> column(C columnKey) { 583 checkNotNull(columnKey); 584 Integer columnIndex = columnKeyToIndex.get(columnKey); 585 return (columnIndex == null) ? ImmutableMap.<R, V>of() : new Column(columnIndex); 586 } 587 588 private class Column extends ArrayMap<R, V> { 589 final int columnIndex; 590 591 Column(int columnIndex) { 592 super(rowKeyToIndex); 593 this.columnIndex = columnIndex; 594 } 595 596 @Override 597 String getKeyRole() { 598 return "Row"; 599 } 600 601 @Override 602 V getValue(int index) { 603 return at(index, columnIndex); 604 } 605 606 @Override 607 V setValue(int index, V newValue) { 608 return set(index, columnIndex, newValue); 609 } 610 } 611 612 /** 613 * Returns an immutable set of the valid column keys, including those that 614 * are associated with null values only. 615 * 616 * @return immutable set of column keys 617 */ 618 @Override 619 public ImmutableSet<C> columnKeySet() { 620 return columnKeyToIndex.keySet(); 621 } 622 623 private transient ColumnMap columnMap; 624 625 @Override 626 public Map<C, Map<R, V>> columnMap() { 627 ColumnMap map = columnMap; 628 return (map == null) ? columnMap = new ColumnMap() : map; 629 } 630 631 @WeakOuter 632 private class ColumnMap extends ArrayMap<C, Map<R, V>> { 633 private ColumnMap() { 634 super(columnKeyToIndex); 635 } 636 637 @Override 638 String getKeyRole() { 639 return "Column"; 640 } 641 642 @Override 643 Map<R, V> getValue(int index) { 644 return new Column(index); 645 } 646 647 @Override 648 Map<R, V> setValue(int index, Map<R, V> newValue) { 649 throw new UnsupportedOperationException(); 650 } 651 652 @Override 653 public Map<R, V> put(C key, Map<R, V> value) { 654 throw new UnsupportedOperationException(); 655 } 656 } 657 658 /** 659 * Returns a view of all mappings that have the given row key. If the 660 * row key isn't in {@link #rowKeySet()}, an empty immutable map is 661 * returned. 662 * 663 * <p>Otherwise, for each column key in {@link #columnKeySet()}, the returned 664 * map associates the column key with the corresponding value in the 665 * table. Changes to the returned map will update the underlying table, and 666 * vice versa. 667 * 668 * @param rowKey key of row to search for in the table 669 * @return the corresponding map from column keys to values 670 */ 671 @Override 672 public Map<C, V> row(R rowKey) { 673 checkNotNull(rowKey); 674 Integer rowIndex = rowKeyToIndex.get(rowKey); 675 return (rowIndex == null) ? ImmutableMap.<C, V>of() : new Row(rowIndex); 676 } 677 678 private class Row extends ArrayMap<C, V> { 679 final int rowIndex; 680 681 Row(int rowIndex) { 682 super(columnKeyToIndex); 683 this.rowIndex = rowIndex; 684 } 685 686 @Override 687 String getKeyRole() { 688 return "Column"; 689 } 690 691 @Override 692 V getValue(int index) { 693 return at(rowIndex, index); 694 } 695 696 @Override 697 V setValue(int index, V newValue) { 698 return set(rowIndex, index, newValue); 699 } 700 } 701 702 /** 703 * Returns an immutable set of the valid row keys, including those that are 704 * associated with null values only. 705 * 706 * @return immutable set of row keys 707 */ 708 @Override 709 public ImmutableSet<R> rowKeySet() { 710 return rowKeyToIndex.keySet(); 711 } 712 713 private transient RowMap rowMap; 714 715 @Override 716 public Map<R, Map<C, V>> rowMap() { 717 RowMap map = rowMap; 718 return (map == null) ? rowMap = new RowMap() : map; 719 } 720 721 @WeakOuter 722 private class RowMap extends ArrayMap<R, Map<C, V>> { 723 private RowMap() { 724 super(rowKeyToIndex); 725 } 726 727 @Override 728 String getKeyRole() { 729 return "Row"; 730 } 731 732 @Override 733 Map<C, V> getValue(int index) { 734 return new Row(index); 735 } 736 737 @Override 738 Map<C, V> setValue(int index, Map<C, V> newValue) { 739 throw new UnsupportedOperationException(); 740 } 741 742 @Override 743 public Map<C, V> put(R key, Map<C, V> value) { 744 throw new UnsupportedOperationException(); 745 } 746 } 747 748 /** 749 * Returns an unmodifiable collection of all values, which may contain 750 * duplicates. Changes to the table will update the returned collection. 751 * 752 * <p>The returned collection's iterator traverses the values of the first row 753 * key, the values of the second row key, and so on. 754 * 755 * @return collection of values 756 */ 757 @Override 758 public Collection<V> values() { 759 return super.values(); 760 } 761 762 private static final long serialVersionUID = 0; 763}