code: public void optimizedSwitch(String def, LookupList list) throws IOException
      {
          if (list.isEmpty())
          {
              throw new IllegalArgumentException("empty lookuplist");
          }
          if (list.size() == 1)
          {
              for (LookupPair lp : list)
              {
                  iconst(lp.getMatch());
                  if_icmpeq(lp.getTarget());
              }
              goto_n(def);
          }
          else
          {
              if (optimize && list.canOptimize())
              {
                  for (LookupPair lp : list)
                  {
                      String next = createBranch();
                      dup();
                      iconst(lp.getMatch());
                      if_icmpne(next);
                      pop();
                      goto_n(lp.getTarget());
                      fixAddress(next);
                  }
                  pop();
                  goto_n(def);
              }
              else
              {
                  if (list.isContiguous())    // note! list is sorted at this point
                  {
                      String[] symbols = new String[list.size()];
                      int index = 0;
                      for (LookupPair lp : list)
                      {
                          symbols[index++] = lp.getTarget();
                      }
                      tableswitch(def, list.get(0).getMatch(), list.get(list.size()-1).getMatch(), symbols);
                  }
                  else
                  {
                      lookupswitch(def, list);
                  }
              }
          }
      }
docs: Compiles a tableswitch, lookupswitch or if/goto depending on contents of
  LookupList.
  <p>Stack: ..., index =&gt; ...,
  @param def
  @param list
  @throws IOException