Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java get unique elements from array

String[] unique = Arrays.stream(array).distinct().toArray(String[]::new);
Comment

unique elements in array java

int [] arr = {1,1,1,2,2,2,3,3,3,4,4,5,5,6,7,8,};

for (int j= 0; j < arr.length; j++){
int count1 = 0; // to find out how many time value is appeared in the arry
for (int i = 0; i < arr.length; i++){
     if(arr[i] == arr[j] ) {    
    // if(arr[i] == 1 ) { once boyleydi ikinci for gelince soldaki oldu
      count1++; // arraydeki harfleri tek tek saymak icin
  }
 }
    if(count1 == 1 ){
    System.out.print(arr[j]+" ");// 6 7 8 uniqe
 }
Comment

PREVIOUS NEXT
Code Example
Java :: how to the text of an element in selenium java 
Java :: how to change color page in latex 
Java :: how to initialize an array in java 
Java :: hibernate create query count return 
Java :: how to read a text file in java 
Java :: How to determine if a given binary tree is a binary search tree, in Java? 
Java :: loop through keys only in hashmap java 
Java :: java random 5 digit int 
Java :: create arraylist from array java 
Java :: jackson localdate 
Java :: java math.random 
Java :: java get random char from alphabet 
Java :: loop through a 2d array java 
Java :: free news api for android 
Java ::  
Java :: Java program to find the sum of first 100 numbers 
Java :: java foreach map 
Java :: Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema 
Java :: check if all values are same in list java 
Java :: event api spigot 
Java :: all devisor of a number java 
:: java xmx example 
Java :: java random 
::  
Java :: java regex replace all characters before 
Java :: java delete directory with files 
Java :: get today date in java 8 
Java :: count vowels in java 
Java :: how to acces every char of a String in java 
Java :: bytes to string solidity 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =