Changeset 10972 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2016-09-07T01:23:17+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Utils.java
r10931 r10972 8 8 import java.awt.Color; 9 9 import java.awt.Font; 10 import java.awt.datatransfer.Clipboard;11 import java.awt.datatransfer.Transferable;12 10 import java.awt.font.FontRenderContext; 13 11 import java.awt.font.GlyphVector; … … 54 52 import java.util.regex.Matcher; 55 53 import java.util.regex.Pattern; 56 import java.util.stream.Stream;57 54 import java.util.zip.GZIPInputStream; 58 55 import java.util.zip.ZipEntry; … … 69 66 import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream; 70 67 import org.openstreetmap.josm.Main; 71 import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils;72 68 import org.w3c.dom.Document; 73 69 import org.xml.sax.InputSource; … … 99 95 private Utils() { 100 96 // Hide default constructor for utils classes 101 }102 103 /**104 * Tests whether {@code predicate} applies to at least one element from {@code collection}.105 * <p>106 * @param <T> type of items107 * @param collection the collection108 * @param predicate the predicate109 * @return {@code true} if {@code predicate} applies to at least one element from {@code collection}110 * @deprecated use {@link Stream#anyMatch(Predicate)} instead.111 */112 @Deprecated113 public static <T> boolean exists(Iterable<? extends T> collection, Predicate<? super T> predicate) {114 for (T item : collection) {115 if (predicate.test(item)) {116 return true;117 }118 }119 return false;120 }121 122 /**123 * Tests whether {@code predicate} applies to all elements from {@code collection}.124 * <p>125 * @param <T> type of items126 * @param collection the collection127 * @param predicate the predicate128 * @return {@code true} if {@code predicate} applies to all elements from {@code collection}129 * @deprecated use {@link Stream#allMatch(Predicate)} instead.130 */131 @Deprecated132 public static <T> boolean forAll(Iterable<? extends T> collection, Predicate<? super T> predicate) {133 return !exists(collection, predicate.negate());134 97 } 135 98 … … 580 543 } 581 544 return true; 582 }583 584 /**585 * Copies the string {@code s} to system clipboard.586 * @param s string to be copied to clipboard.587 * @return true if succeeded, false otherwise.588 * @deprecated Use {@link ClipboardUtils#copyString(String)}. To be removed end of 2016.589 */590 @Deprecated591 public static boolean copyToClipboard(String s) {592 return ClipboardUtils.copyString(s);593 }594 595 /**596 * Extracts clipboard content as {@code Transferable} object.597 * @param clipboard clipboard from which contents are retrieved598 * @return clipboard contents if available, {@code null} otherwise.599 * @since 8429600 * @deprecated Use {@link ClipboardUtils#getClipboardContent(Clipboard)} instead. To be removed end of 2016.601 */602 @Deprecated603 public static Transferable getTransferableContent(Clipboard clipboard) {604 return ClipboardUtils.getClipboardContent(clipboard);605 }606 607 /**608 * Extracts clipboard content as string.609 * @return string clipboard contents if available, {@code null} otherwise.610 * @deprecated Use {@link ClipboardUtils#getClipboardStringContent()}. To be removed end of 2016611 */612 @Deprecated613 public static String getClipboardContent() {614 return ClipboardUtils.getClipboardStringContent();615 545 } 616 546
Note:
See TracChangeset
for help on using the changeset viewer.