Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 15th, 2012  |  syntax: None  |  size: 0.78 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. What is happening behind the scenes?
  2. private void checkColumns(String[] projection) {
  3.         String[] available = { TodoTable.COLUMN_CATEGORY,
  4.                 TodoTable.COLUMN_SUMMARY, TodoTable.COLUMN_DESCRIPTION,
  5.                 TodoTable.COLUMN_ID };
  6.         if (projection != null) {
  7.             HashSet<String> requestedColumns = new HashSet<String>(
  8.                     Arrays.asList(projection));
  9.             HashSet<String> availableColumns = new HashSet<String>(
  10.                     Arrays.asList(available));
  11.             // Check if all columns which are requested are available
  12.             if (!availableColumns.containsAll(requestedColumns)) {
  13.                 throw new IllegalArgumentException(
  14.                         "Unknown columns in projection");
  15.             }
  16.         }
  17.     }