---
Product: Aspose.Slides
Platform: java
Page Type: reference
Canonical URL: https://reference.aspose.org/slides/java/PortionCollection
---

# PortionCollection

## Overview

`PortionCollection` is a class in Aspose.Slides FOSS for Java.
Inherits from: `IPortionCollection`.

Represents a collection of text portions within a paragraph.

This class provides 16 methods for working with PortionCollection objects in Java programs.
Available methods include: `PortionCollection`, `add`, `asIEnumerable`, `clear`, `contains`, `count`, `get`, `indexOf`, `insert`, `isReadOnly`, `iterator`, `remove`, and 2 additional methods.
All public members are accessible to any Java application after installing the Aspose.Slides FOSS for Java package.
Properties: `readOnly`.

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `readOnly` | `boolean` | Read | Gets the read only. |

## Methods

| Signature | Description |
|-----------|-------------|
| `PortionCollection()` | Creates an empty PortionCollection. |
| `PortionCollection(portions: List)` | Creates a PortionCollection with the given initial portions. |
| `PortionCollection(pElement: Element, saveCallback: Runnable)` | Creates an XML-backed PortionCollection. |
| `get(index: int)` → `IPortion` | Returns the IPortion at the specified index |
| `size()` → `int` |  |
| `count()` → `int` | Returns the number of portions (alias of size) |
| `isReadOnly()` → `boolean` | Returns true if read only is set. |
| `asIEnumerable()` → `Iterable` | Provides an Iterable over the portions |
| `add(value: IPortion)` | Appends a portion to the end of the collection |
| `indexOf(item: IPortion)` → `int` | Returns the index of the specified portion or -1 |
| `insert(index: int, value: IPortion)` | Inserts a portion at the given index |
| `clear()` |  |
| `contains(item: IPortion)` → `boolean` | Checks if the collection includes the specified portion |
| `remove(item: IPortion)` → `boolean` | Deletes the first occurrence of the portion and returns success |
| `removeAt(index: int)` | Deletes the portion at the given index |
| `iterator()` → `Iterator` | Returns an iterator over the portions |

## See Also

- [Aspose.Slides — Enterprise API Reference](https://reference.aspose.com/slides/)