Here you can find the source of columnContains(TableModel table, int colIdx, T... values)
public static <T> boolean columnContains(TableModel table, int colIdx, T... values)
//package com.java2s; //License from project: Open Source License import java.util.Arrays; import java.util.HashSet; import javax.swing.table.TableModel; public class Main { public static <T> boolean columnContains(TableModel table, int colIdx, T... values) {/*from w w w . j a va 2s.c o m*/ HashSet<T> set = new HashSet<T>(); set.addAll(Arrays.asList(values)); for (int i = 0; i < table.getRowCount(); i++) { set.remove(table.getValueAt(i, colIdx)); if (set.isEmpty()) { return true; } } return false; } public static <T> boolean columnContains(TableModel table, int colIdx, T value) { for (int i = 0; i < table.getRowCount(); i++) { if (value.equals(table.getValueAt(i, colIdx))) { return true; } } return false; } }