Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
deusaquilus authored Dec 29, 2023
1 parent 0449323 commit 94df283
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ println(pprint(p))
```

It will print the following beautiful output:
![Screenshot from 2023-12-29 15-20-52](https://github.com/deusaquilus/pprint-kotlin/assets/1369480/ce866664-7959-46fb-a8c8-9a636a315281)


## <img src="https://github.com/deusaquilus/pprint-kotlin/assets/1369480/ce866664-7959-46fb-a8c8-9a636a315281" width=50% height=50%>

PPrint-Kotlin supports most of the same features and options as the Scala version.
I will document them here over time however for now please refer to the Scala documentation
Expand All @@ -33,20 +32,22 @@ I will document them here over time however for now please refer to the Scala do

## Nested Data and Complex Collections

PPrint excels at printing nested data structures and complex collections.
PPrint excels at printing nested data structures and complex collections. For example:

For example, lists embedded in objects:
#### Lists embedded in objects:
```kotlin
data class Address(val street: String, val zip: Int)
data class Customer(val name: Name, val addresses: List<Address>)

val p = Customer(Name("Joe", "Bloggs"), listOf(Address("foo", 123), Address("bar", 456), Address("baz", 789)))
println(pprint(p))
```
![Screenshot from 2023-12-29 15-23-12](https://github.com/deusaquilus/pprint-kotlin/assets/1369480/3c7b7e18-d246-451c-ae3d-bfcc102ccefc)


Maps embedded in objects:
## <img src="https://github.com/deusaquilus/pprint-kotlin/assets/1369480/3c7b7e18-d246-451c-ae3d-bfcc102ccefc" width=50% height=50%>


#### Maps embedded in objects:
```kotlin
data class Alias(val value: String)
data class ComplexCustomer(val name: Name, val addressAliases: Map<Alias, Address>)
Expand All @@ -58,10 +59,12 @@ val p =
)
println(pprint(p))
```
![Screenshot from 2023-12-29 15-25-54](https://github.com/deusaquilus/pprint-kotlin/assets/1369480/813afad2-1cfa-4629-b2a8-253ac47254a4)

## <img src="https://github.com/deusaquilus/pprint-kotlin/assets/1369480/813afad2-1cfa-4629-b2a8-253ac47254a4" width=50% height=50%>


#### Lists embedded in maps embedded in objects:

Lists embedded in maps imbedded in objects:
```kotlin
val p =
VeryComplexCustomer(
Expand All @@ -77,7 +80,8 @@ val p =
)
println(pprint(p))
```
![Screenshot from 2023-12-29 15-32-13](https://github.com/deusaquilus/pprint-kotlin/assets/1369480/4f3aeb69-315f-4fd7-b831-c568c6daa26c)

## <img src="https://github.com/deusaquilus/pprint-kotlin/assets/1369480/4f3aeb69-315f-4fd7-b831-c568c6daa26c" width=50% height=50%>



Expand Down

0 comments on commit 94df283

Please sign in to comment.