Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First of all, something like is wrong:</p> <pre><code>Vector&lt;String&gt; set = new &lt;String&gt;Vector(); </code></pre> <p>The correct syntax is this:</p> <pre><code>Vector&lt;String&gt; set = new Vector&lt;String&gt;(); </code></pre> <p>Second of all, if you do something like this:</p> <pre><code>Vector&lt;String&gt; set1,set2,set3,set4,set5 = new Vector&lt;String&gt;(); </code></pre> <p>...only <code>set5</code> will be initialized. Each variable must be initialized independently. You <em>could</em> do something like this:</p> <pre><code>Vector&lt;String&gt; set1,set2,set3,set4,set5; set1 = set2 = set3 = set4 = set5 = new Vector&lt;String&gt;(); </code></pre> <p>...but then all of the variables would point to the same <code>Vector</code>, and modifications to one variable would affect all the others. You'll have to initialize each variable separately.</p> <p>Third, doing this:</p> <pre><code>candidatesSet = null; </code></pre> <p>...does nothing if <code>candidatesSet</code> is not initialized yet, since non-primitive instance variables are initialized to null anyway. That's your problem, you're calling <code>.add(String)</code> on a null object, which cases a <code>NullPointerException</code>.</p> <p>Fixing those issues will make your code work, but there's one last problem. <code>Vector</code> is a somewhat outdated class, and it has been replaced by the Java Collections API. Try using <a href="http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html" rel="nofollow"><code>ArrayList</code></a> instead of <code>Vector</code>, like so:</p> <pre><code>List&lt;String&gt; candidatesSet = new ArrayList&lt;String&gt;(); </code></pre> <p>This will make your code more efficient and less archaic.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload