1773 // public methods 1774 1775 public boolean isEmpty() { 1776 return (fromStart && toEnd) ? m.isEmpty() : entrySet().isEmpty(); 1777 } 1778 1779 public int size() { 1780 return (fromStart && toEnd) ? m.size() : entrySet().size(); 1781 } 1782 1783 public final boolean containsKey(Object key) { 1784 return inRange(key) && m.containsKey(key); 1785 } 1786 1787 public final V put(K key, V value) { 1788 if (!inRange(key)) 1789 throw new IllegalArgumentException("key out of range"); 1790 return m.put(key, value); 1791 } 1792 1793 public final V get(Object key) { 1794 return !inRange(key) ? null : m.get(key); 1795 } 1796 1797 public final V remove(Object key) { 1798 return !inRange(key) ? null : m.remove(key); 1799 } 1800 1801 public final Map.Entry<K,V> ceilingEntry(K key) { 1802 return exportEntry(subCeiling(key)); 1803 } 1804 1805 public final K ceilingKey(K key) { 1806 return keyOrNull(subCeiling(key)); 1807 } 1808 1809 public final Map.Entry<K,V> higherEntry(K key) { 1810 return exportEntry(subHigher(key)); 1811 } 1812 | 1773 // public methods 1774 1775 public boolean isEmpty() { 1776 return (fromStart && toEnd) ? m.isEmpty() : entrySet().isEmpty(); 1777 } 1778 1779 public int size() { 1780 return (fromStart && toEnd) ? m.size() : entrySet().size(); 1781 } 1782 1783 public final boolean containsKey(Object key) { 1784 return inRange(key) && m.containsKey(key); 1785 } 1786 1787 public final V put(K key, V value) { 1788 if (!inRange(key)) 1789 throw new IllegalArgumentException("key out of range"); 1790 return m.put(key, value); 1791 } 1792 1793 public V putIfAbsent(K key, V value) { 1794 if (!inRange(key)) 1795 throw new IllegalArgumentException("key out of range"); 1796 return m.putIfAbsent(key, value); 1797 } 1798 1799 public V merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) { 1800 if (!inRange(key)) 1801 throw new IllegalArgumentException("key out of range"); 1802 return m.merge(key, value, remappingFunction); 1803 } 1804 1805 public V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) { 1806 if (!inRange(key)) { 1807 if (mappingFunction.apply(key) == null) return null; 1808 throw new IllegalArgumentException("key out of range"); 1809 } 1810 return m.computeIfAbsent(key, mappingFunction); 1811 } 1812 1813 public V compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) { 1814 if (!inRange(key)) { 1815 if (remappingFunction.apply(key, null) == null) return null; 1816 throw new IllegalArgumentException("key out of range"); 1817 } 1818 return m.compute(key, remappingFunction); 1819 } 1820 1821 public V computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) { 1822 return !inRange(key) ? null : m.computeIfPresent(key, remappingFunction); 1823 } 1824 1825 public final V get(Object key) { 1826 return !inRange(key) ? null : m.get(key); 1827 } 1828 1829 public final V remove(Object key) { 1830 return !inRange(key) ? null : m.remove(key); 1831 } 1832 1833 public final Map.Entry<K,V> ceilingEntry(K key) { 1834 return exportEntry(subCeiling(key)); 1835 } 1836 1837 public final K ceilingKey(K key) { 1838 return keyOrNull(subCeiling(key)); 1839 } 1840 1841 public final Map.Entry<K,V> higherEntry(K key) { 1842 return exportEntry(subHigher(key)); 1843 } 1844 |