'value'에 해당되는 글 3건

  1. 2021.09.14 [Java] List 중복 제거.
  2. 2017.04.18 [Java] Array Value 존재 유무 확인하기
  3. 2015.07.29 [Kibana4.x] Value format 설정하기

[Java] List 중복 제거.

ITWeb/개발일반 2021. 9. 14. 12:34

DictionaryModel 은 String, List<String> 맴버 변수를 가집니다.

이 맴버 변수 중 List<String> 을 모두 펼쳐서 distinct word 목록을 만들려고 합니다.

 

List<String> flats = new ArrayList<>();
List<String> words = new ArrayList<>();

for (DictionaryModel d : dictionarys ) {
	words.addAll(d.getAnalyzed());
}

flats = words.stream().distinct().collect(Collectors.toList());

기억력을 돕기 위해 기록해 봅니다.

 

:

[Java] Array Value 존재 유무 확인하기

ITWeb/개발일반 2017. 4. 18. 10:38

생각 나지 않을때가 많아서 퍼왔습니다.


Originanl Source)

http://www.programcreek.com/2014/04/check-if-array-contains-a-value-java/


public static boolean useList(String[] arr, String targetValue) {

  return Arrays.asList(arr).contains(targetValue);

}


public static boolean useSet(String[] arr, String targetValue) {

  Set<String> set = new HashSet<String>(Arrays.asList(arr));

  return set.contains(targetValue);

}


public static boolean useLoop(String[] arr, String targetValue) {

  for(String s: arr){

    if(s.equals(targetValue))

      return true;

  }

  return false;

}


public static boolean useArraysBinarySearch(String[] arr, String targetValue) { 

  int a =  Arrays.binarySearch(arr, targetValue);

  if(a > 0)

    return true;

  else

    return false;

}


binary search 가 제일 성능이 좋습니다.

단, 위 코드에서 빠진게 있다면 Arrays.sort(arr) 를 먼저 하고 하셔야 된다는 것입니다.


Arrays.sort(arr);

int a = Arrays.binarySearch(arr, targetValue);

:

[Kibana4.x] Value format 설정하기

Elastic/Kibana 2015. 7. 29. 17:46

kibana를 이용하다 보면 화면에 보여지는 값에 대한 format 을 고치고 싶은 욕구가 생깁니다.

이걸 어디서 고쳐줘야 하나 싶은데 역시 매뉴 몇번 눌러 보면 찾을 수 있습니다.

귀찮아 하시는 분들을 위해 공유해 봅니다.


[참고문서]

https://www.elastic.co/blog/kibana-4-1-field-formatters


[매뉴 tree]

## Global 설정

GNB -> Settings -> Advanced


## 특정 인덱스의 field format을 바꾸고 싶을 경우

GNB -> Settings -> Indices -> Select Index Patterns -> controls 컬럼에서 수정하고자 하는 field 클릭


[Advanced 화면]



: