@Override
 public List<VocabularyWord> getWords(String uiLanguageId, String learningLanguageId) {
   return Stream.of(cache)
       .filter(word -> word.getUiLanguage().equals(uiLanguageId))
       .filter(word -> word.getLearningLanguage().equals(learningLanguageId))
       .collect(toList());
 }
示例#2
0
  public void initModifications(Modification[] modifications) {
    this.modifications = modifications;
    LayoutInflater inflater =
        (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.modification_menu, null);
    LinearLayout rootPopupView = (LinearLayout) view.findViewById(R.id.modification_root_layout);
    int size = modifications.length;
    Stream.of(modifications)
        .forEach(
            modification -> {
              LinearLayout headerLayout =
                  (LinearLayout) inflater.inflate(R.layout.modification_item, null);
              headerLayout.setTag(modification.id);
              TextView headerText = (TextView) headerLayout.findViewById(R.id.modification_title);
              headerText.setText(modification.title);
              TextView valueText = (TextView) headerLayout.findViewById(R.id.modification_value);
              valueText.setText(modification.getDefaultTitle());
              rootPopupView.addView(headerLayout);

              headerLayout.setOnClickListener(
                  e -> {
                    initDialog(modification);
                  });
            });

    if (size > 0) {
      setDividerGone(view, modifications[size - 1]);
    }

    this.addView(view);
  }
示例#3
0
 public List<String> getProductIds() {
   List<String> ids = new ArrayList<>();
   Stream.of(items)
       .forEach(
           item -> {
             ids.add(item.itemId);
           });
   return ids;
 }
示例#4
0
 private void initDialog(Modification mod) {
   Dialogs.showSelectDialog(
       getContext(),
       mod.title,
       Stream.of(mod.offerModifications).collect(Collectors.toList()),
       this::OfferModificationApply,
       newOfferModification -> {
         mod.setSelectedModification(newOfferModification);
         setModificationValue(newOfferModification.title, mod.id);
       });
 }
  @Override
  protected void onStart() {
    super.onStart();
    final String[] accountsHex = getIntent().getStringArrayExtra(EXTRA_STR_ARR_ACCOUNTS_HEX);
    final List<NacPublicKey> accPublicKeys =
        Stream.of(accountsHex).map(NacPublicKey::new).collect(Collectors.toList());

    final ArrayAdapter<NacPublicKey> adapter =
        new ArrayAdapter<>(this, R.layout.list_item_select_sender, accPublicKeys);
    final ListView accountsList = (ListView) findViewById(R.id.listview_accounts);
    accountsList.setAdapter(adapter);
    accountsList.setOnItemClickListener(this::onAccountClick);
  }
示例#6
0
文件: Author.java 项目: Rufim/Samlib
 public List<Category> getStaticCategory() {
   return Stream.of(getCategories())
       .filter(sec -> sec.getLink() == null)
       .collect(Collectors.toList());
 }