About 52,700 results
Open links in new tab
  1. How do I compare strings in Java? - Stack Overflow

    Apr 2, 2013 · If the compareTo result is 0, then the two strings are equal, otherwise the strings being compared are not equal. The == compares the references and does not compare the …

  2. java - String.equals versus == - Stack Overflow

    Our detective will look closely at all physical aspects. With thorough inquiry, the agent will be able to conclude whether it's the same person or not. Let's see it happen in Java terms. Here's the …

  3. java - How to compare two strings are equal in value, what is the …

    Jul 29, 2014 · String.intern() If you have two strings, you can internate them, i.e. make the JVM create a String pool and returning to you the instance equal to the pool instance (by calling …

  4. string - Is Java's assertEquals method reliable? - Stack Overflow

    If I use equals, however, the equals method will read the two pieces of paper and see that they say the same thing ("Foo"), and so it'll return true. The bit that gets confusing with Strings is …

  5. Java ArrayList - how can I tell if two lists are equal, order not ...

    public static boolean isEqualCollection(java.util.Collection a, java.util.Collection b) Returns `true` iff the given `Collection`s contain exactly the same elements with exactly the same …

  6. How do I use the character's equals() method in Java?

    Sep 1, 2018 · If you want to compare strings (to see if they contain the same characters), you need to compare the strings using equals(). Hence, the operator == checks equality of values …

  7. Java: Checking if a String is equal to a String - Stack Overflow

    Jun 9, 2014 · There are two ways to compare strings: The first is to compare via addresses of the string. Such as: string blue = string red. The second way to compare strings is through values. …

  8. java - How to check if two Strings are approximately equal? - Stack ...

    Sep 25, 2014 · See this question and answer: Getting the closest string match. Using some heuristics and the Levenshtein distance algorithm, you can compute the similarity of two …

  9. java - String.equals() with multiple conditions (and one action on ...

    Apr 18, 2012 · Is it possible to do something like this in Java for Android (this is a pseudo code) IF (some_string.equals("john" OR "mary" OR "peter" OR "etc."){ THEN do something } At the …

  10. Java, how to compare Strings with String Arrays

    Jan 20, 2012 · If one element is equal, you can stop and handle that case. If none of the elements is equal to usercode, then do the appropriate to handle that case. In pseudocode: found = …

Refresh