<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-can-you-create-a-prefilled-list---cracking-the-java-coding-interview-javacoding-javatips-2pnzlu51l" -->

---
title: How can you create a prefilled List?  - Cracking the...
description: A quick tip on creating prefilled lists in Java using the List.of() factory method introduced in JDK 9. Key restrictions include no null values allowed and the...
canonical: https://daily.dev/posts/how-can-you-create-a-prefilled-list---cracking-the-java-coding-interview-javacoding-javatips-2pnzlu51l
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How can you create a prefilled List?  - Cracking the Java Coding Interview #javacoding #javatips | daily.dev
og:description: A quick tip on creating prefilled lists in Java using the List.of() factory method introduced in JDK 9. Key restrictions include no null values allowed and the...
og:url: https://daily.dev/posts/how-can-you-create-a-prefilled-list---cracking-the-java-coding-interview-javacoding-javatips-2pnzlu51l
og:image: https://api.daily.dev/og/posts/2PNzLU51L.png
og:image:alt: How can you create a prefilled List?  - Cracking the Java Coding Interview #javacoding #javatips
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How can you create a prefilled List?  - Cracking the Java Coding Interview #javacoding #javatips

**[Java \(Official Oracle\)](https://daily.dev/sources/java-oracle)** · 1 min read · 0 upvotes · 0 comments

## Summary

A quick tip on creating prefilled lists in Java using the List.of() factory method introduced in JDK 9. Key restrictions include no null values allowed and the resulting list is non-modifiable. The method is optimized for performance and the list is serializable. Equivalent factory methods exist for Set and Map as part of the convenience factory methods for collections feature.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=tnJ_0cnhg5Q>

## Similar posts on daily.dev

- [Java List Series](https://daily.dev/posts/java-list-series-3ol6zzuck) · Baeldung · 3 upvotes · 0 comments

---

Tags: [#java](https://daily.dev/tags/java)

[View this post on daily.dev](https://daily.dev/posts/how-can-you-create-a-prefilled-list---cracking-the-java-coding-interview-javacoding-javatips-2pnzlu51l)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How can you create a prefilled List?  - Cracking the Java Coding Interview #javacoding #javatips","url":"https://daily.dev/posts/how-can-you-create-a-prefilled-list---cracking-the-java-coding-interview-javacoding-javatips-2pnzlu51l","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-can-you-create-a-prefilled-list---cracking-the-java-coding-interview-javacoding-javatips-2pnzlu51l"},"datePublished":"2026-04-07T18:00:38.191Z","dateModified":"2026-04-07T18:01:48.682Z","description":"A quick tip on creating prefilled lists in Java using the List.of() factory method introduced in JDK 9. Key restrictions include no null values allowed and the...","image":"https://i.ytimg.com/vi/tnJ_0cnhg5Q/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/tnJ_0cnhg5Q/sddefault.jpg","isAccessibleForFree":true,"articleSection":"Java (Official Oracle)","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Java (Official Oracle)","logo":"https://media.daily.dev/image/upload/s--SM9hIYUY--/f_auto,q_auto/v1773648791/logos/java-oracle?_a=BAMAMiiu0","url":"https://daily.dev/sources/java-oracle"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-can-you-create-a-prefilled-list---cracking-the-java-coding-interview-javacoding-javatips-2pnzlu51l","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"java","timeRequired":"PT1M","video":{"@type":"VideoObject","name":"How can you create a prefilled List?  - Cracking the Java Coding Interview #javacoding #javatips","description":"A quick tip on creating prefilled lists in Java using the List.of() factory method introduced in JDK 9. Key restrictions include no null values allowed and the...","thumbnailUrl":"https://i.ytimg.com/vi/tnJ_0cnhg5Q/sddefault.jpg","uploadDate":"2026-04-07T18:00:38.191Z","duration":"PT1M","url":"https://api.daily.dev/r/2PNzLU51L","embedUrl":"https://www.youtube.com/embed/tnJ_0cnhg5Q"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Java (Official Oracle)","item":"https://daily.dev/sources/java-oracle"},{"@type":"ListItem","position":3,"name":"How can you create a prefilled List?  - Cracking the Java Coding Interview #javacoding #javatips"}]}
```

