Android : 최근에 최근에 사용 된 (LRU) 알고리즘 구현은 Java에서?

StackOverflow https://stackoverflow.com/questions/5027332

  •  14-11-2019
  •  | 
  •  

문제

내 응용 프로그램의 롯트는 1000 주위에 많은 비트 맵을 가지고 있습니다. 나는 단일 이미지로 병합해야합니다.이렇게하려면 현재 필요한 비트 맵을 sdcard에서로드합니다.이 프로세스는 최근에 사용 된 비트 맵을 재활용해야합니다. 다른 현명한 DVM은 메모리 오류가 발생하지 않습니다.그래서 어떤 사람은 Java 에서이 작업 (최근에 사용되지 않음)을 수행하는 방법을 말해 줄 수 있습니다. ??

고마워, srinivas

도움이 되었습니까?

해결책

You may want to look into the LinkedHashMap or LinkedHashSet implementations in the Collections API, which provide support for a highly-configurable LRU framework.

다른 팁

LinkedHashMap would be perfect fit for this type of problems.removeEldestEntry() method of LinkedHashMap class returns true to remove oldest entry

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top