Exemplo n.º 1
1
  private String[] expStringToArray(String exp) {

    String[] splitExp = new String[exp.length()];
    Arrays.fill(splitExp, "");

    int j = 0;
    for (int i = 0; i < exp.length(); ++i) {
      char ch = exp.charAt(i);

      if (ch == '+' || ch == '-') {
        splitExp[++j] += ch;
      } else if (ch == '*' || ch == '/') {
        splitExp[++j] += ch;
        ++j;
      } else {
        splitExp[j] += ch;
      }
    }

    ArrayList<String> utilityArray = new ArrayList<>(Arrays.asList(splitExp));
    Predicate<String> p = (s) -> s.equals("");

    utilityArray.removeIf(p);
    splitExp = new String[0];
    splitExp = utilityArray.toArray(splitExp);
    return splitExp;
  }
Exemplo n.º 2
1
 public boolean deleteLastShelf() {
   if (list.size() <= 0) {
     return false;
   }
   StoreLocation last = list.get(list.size() - 1);
   int row = last.getRow();
   int shelf = last.getShelf();
   list.removeIf(
       cell -> {
         return cell.getRow() == row && cell.getShelf() == shelf;
       });
   return true;
 }
 public void deleteBook(int id) {
   Book book = null;
   boolean condition = false;
   for (Book b : books) {
     if (b.getId() == id) {
       condition = true;
       book = b;
       break;
     }
   }
   if (condition) {
     books.removeIf((Book b) -> b.getId() == id);
   }
   if (book == null) {
     logger.warn("Book with id:" + Integer.toString(id) + " doesn't exists.");
   }
 }
Exemplo n.º 4
1
 public ArrayList<File> loadDefault() {
   File fprintFile = Environment.DIR_FPRINT_GM.getDir();
   ArrayList<File> files = new ArrayList<>(Arrays.asList(fprintFile.listFiles()));
   files.removeIf(File::isDirectory);
   return files;
 }