Card-Forge / Card-Forge/forge

FCollection View vs unmodifiable vs Immutable Refactor

Open
#3,397 15 comments 0 reactions 2 assignees Claimed by @Jetz72 View on GitHub
Game Mechanics keep
Dominant language
Java
Stars
2.7k
Forks
1.1k
Avg merge
1d 1h
Merged PRs (30d)
158

Description

Currently the FCollection View sits in the FCollection Class and doesn't implement either java Collection or java List
so each time we get a View and want to iterate over it in a different way, or want to get the size/empty check we need to cast to List or make a new Array List?

small steps:

- Make View implement List and Collection class, but make them fail on change, maybe implement them as Immutable List?
- Also use Immutable for EmptyFCollection ?
- Maybe add an Interface for FCollection that has all the methods (including the Modifying ones) and have View and Empty Collection use that Interface
- Implement FCollection as [ForwardingList](https://guava.dev/releases/snapshot/api/docs/com/google/common/collect/ForwardingList.html), + some Set Functions then it should be more easy to put a Immutable List inside for Empty?
- Or implement it as [SetUniqueList](https://commons.apache.org/proper/commons-collections/javadocs/api-3.2.2/index.html?org/apache/commons/collections/list/SetUniqueList.html) / [SetUniqueList](https://commons.apache.org/proper/commons-collections/apidocs/org/apache/commons/collections4/list/SetUniqueList.html)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.