Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

17
LINES

< > BotCompany Repo | #1026015 // conceptsSortedByField - try to use index if possible

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (13031L/88K).

sbool conceptsSortedByField_verbose;

static <A extends Concept> Cl<A> nuLike conceptsSortedByField(Class<A> c, S field) {
  ret conceptsSortedByField(db_mainConcepts(), c, field);
}

static <A extends Concept> Cl<A> conceptsSortedByField(Concepts concepts, Class<A> c, S field) {
  // indexed
  IFieldIndex<A, O> index = concepts.getFieldIndex(c, field);
  if (index cast ConceptFieldIndexDesc)
    ret reverseInPlace(asList(index.objectIterator()));
    
  // sort manually
  if (conceptsSortedByField_verbose)
    print("conceptsSortedByField_verbose: Manual sort of " + c + " for " + field);
  ret sortedByField(field, concepts.list(c));
}

Author comment

Began life as a copy of #1025936

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1026015
Snippet name: conceptsSortedByField - try to use index if possible
Eternal ID of this version: #1026015/3
Text MD5: 7ec877af50019ac0c4e51c45d418d2c1
Transpilation MD5: ea2bb29a55741ee53f11883877598b86
Author: stefan
Category: javax / concepts
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-11-07 15:00:22
Source code size: 659 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 308 / 433
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1027570 - conceptsSortedByFields - doesn't use index yet
#1029647 - conceptsWithFieldLessThan
#1029667 - conceptsSortedByFieldAlphanumIC