> For the complete documentation index, see [llms.txt](https://docs.yemreak.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.yemreak.com/arsiv/kotlin/diziler.md).

# Diziler

Kotlin'de diziler

## 🔰 Diziler (Arrays)

`val dizi = arrayOfNulls<String>(10)`

* String : Değişken tipi
* 10 : Dizi boyutu
* dizi\[0] = "Dizi 0"
* dizi\[1] = "dizi 1" şeklinde tanımlanır.

> Not: val olan dizi değişkenimiz oluyor, dizi\[0] val olmuyor, var oluyor. Atama yapılabiliyor.

`val sayıDizisi = intArrayOf(1, 2, 3, 4)`

* 1, 2, 3, 4 sırasıyla 0, 1 ,2 ,3. indexlerin değerleri
* sayıDizisi.set(2, 9)
  * 2 : index
  * 9 : index'e yerleşecek değer.

> (dizideki 3 değeri 9 olacak, yeni dizi : 1, 2, 9, 4)

## ✨ Boyutu Değiştirilebilen Diziler

`val liste = ArrayList<String>()`

* String : değişken tipi
* liste.add("liste1")
* liste.add("liste 2")
* liste.add("liste 2")
* liste.add(1, "Hello")
  * 1 : index
  * "Hello" değişkene atanan değer
  * liste'nin değerleri \["liste1", "Hello", "liste2", "liste2"]

## 🎡 Her Elemanı Farklı Olan Diziler

`val küme = HashSet<Int>()`

* Int : Değişken tipi
* küme.add(2)
* küme.add(2) // 2 tane aynı değer olamaz bu kaydedilmez. (Set özelliği)
* küme.add(0, 3)
  * 0 : index
  * 3 : değer
  * küme'nin değerleri \[3, 2]

`val harita= HashMap<String, Double>`

* String : Key (Konum bilgisi , anahtarı)
* Double : Değer
* harita.add("ilkdeger", 1.0)
* harita.add("ikincideger", 2.6)
* harita.get("ilkdeğer") // Verileri almak için yapılır.
  * ilkdeğer : anahtar değeri
* harita dizisinde
  * ilkdeğer indexinde 1.0
  * ikincideğer indexinde 2.6 var.

## 🔪 Dizileri Parçalama

* 🎯 Range metodu kullanılarak diziler parçalanabilmekte
* 🐥 Çok kolay kullanımı vardır

> 🐍 Python dizi parçalama işlemlerine benzemektedir

```kotlin
val byteArray = ByteArray()

byteArray.slice(0..1)

val bas = 10
val son = 100
byteArray.slice(bas..son)
```

## 🧐 Filtreleme

```kotlin
val numbers = listOf("one", "two", "three", "four")  
val longerThan3 = numbers.filter { it.length > 3 }
println(longerThan3)

number.none { it.length > 5 } // Eğer 5 ten büyük yoksa true
```

{% hint style="info" %}
‍🧙‍♂ Detaylı bilgi için [Filtering](https://kotlinlang.org/docs/reference/collection-filtering.html) alanına bakabilirsin.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.yemreak.com/arsiv/kotlin/diziler.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
