ArrayList not available outside of listener
<p>I have a JTable. When the user selects a columns the idea is that the float data is added to an ArrayList. I'll try to do some stats on the arrayList later on.</p>

<p>At the moment I am managing to add the required data to the ArrayList and can see the data when I print to the console from within the listener. However the data isnt available from outside of the listener even theough the ArrayList is declared from outside of the Listener.</p>

<pre><code>        TableColumnModel columnModelCompareL = table_CompareL.getColumnModel();
         ArrayList&lt;Float&gt; statsCompareL=new ArrayList&lt;Float&gt;();
         columnModelCompareL.addColumnModelListener(new TableColumnModelListener() {
                    public void columnSelectionChanged(ListSelectionEvent e) {
                          Object[] data = columnToArray(table_CompareL,table_CompareL.getSelectedColumn());
                        System.out.println("MY data length"+data.length);
                        try {
                            for(int i = 0; i &lt; data.length; i++){
                                if (data[i]!=null){
                                try {
                                    statsCompareL.add(Float.parseFloat((data[i]).toString().trim()));
                                } catch (Exception e1) {
                                    System.out.println("nought to add here");
                                }
                                }
                            }
                        } catch (NumberFormatException e1) {
                            System.out.println("You haven't selected a numeric column. Please select again");
                        }
                    }
                    @Override
                    public void columnAdded(TableColumnModelEvent e) {
                    }

                    @Override
                    public void columnRemoved(TableColumnModelEvent e) {
                    }

                    @Override
                    public void columnMoved(TableColumnModelEvent e) {
                    }

                    @Override
                    public void columnMarginChanged(ChangeEvent e) {
                    }
                });

        System.out.println("statsCompareL"+statsCompareL);
</code></pre>