# SizeFCompat

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/util/SizeFCompat.java+class:androidx.core.util.SizeFCompat) Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/core#1.8.0)

*** ** * ** ***


```
public final class SizeFCompat
```

<br />

*** ** * ** ***

Immutable class for describing width and height dimensions in some arbitrary unit. Width and height are finite values stored as a floating point representation.

This is a backward-compatible version of `https://developer.android.com/reference/android/util/SizeF.html`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/core/util/SizeFCompat#SizeFCompat(float,float)(float width, float height)` |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/core/util/SizeFCompat#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object.html o)` |
| `float` | `https://developer.android.com/reference/androidx/core/util/SizeFCompat#getHeight()()` Get the height of the size (as an arbitrary unit). |
| `float` | `https://developer.android.com/reference/androidx/core/util/SizeFCompat#getWidth()()` Get the width of the size (as an arbitrary unit). |
| `int` | `https://developer.android.com/reference/androidx/core/util/SizeFCompat#hashCode()()` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/util/SizeF.html` | `https://developer.android.com/reference/androidx/core/util/SizeFCompat#toSizeF()()` Converts this `https://developer.android.com/reference/androidx/core/util/SizeFCompat` into a `https://developer.android.com/reference/android/util/SizeF.html`. |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/SizeFCompat` | `https://developer.android.com/reference/androidx/core/util/SizeFCompat#toSizeFCompat(android.util.SizeF)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/util/SizeF.html size)` Converts this `https://developer.android.com/reference/android/util/SizeF.html` into a `https://developer.android.com/reference/androidx/core/util/SizeFCompat`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/core/util/SizeFCompat#toString()()` |

| ### Extension functions |
|---|---|
| `final float` | `https://developer.android.com/reference/androidx/core/util/SizeKt.https://developer.android.com/reference/androidx/core/util/SizeFCompat#(androidx.core.util.SizeFCompat).component1()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/util/SizeFCompat receiver)` Returns "width", the first component of this `https://developer.android.com/reference/androidx/core/util/SizeFCompat`. |
| `final float` | `https://developer.android.com/reference/androidx/core/util/SizeKt.https://developer.android.com/reference/androidx/core/util/SizeFCompat#(androidx.core.util.SizeFCompat).component2()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/util/SizeFCompat receiver)` Returns "height", the second component of this `https://developer.android.com/reference/androidx/core/util/SizeFCompat`. |

## Public constructors

### SizeFCompat

Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/core#1.8.0)

```
public SizeFCompat(float width, float height)
```

## Public methods

### equals

```
public boolean equals(Object o)
```

### getHeight

Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/core#1.8.0)

```
public float getHeight()
```

Get the height of the size (as an arbitrary unit).

| Returns |
|---|---|
| `float` | height |

### getWidth

Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/core#1.8.0)

```
public float getWidth()
```

Get the width of the size (as an arbitrary unit).

| Returns |
|---|---|
| `float` | width |

### hashCode

```
public int hashCode()
```

### toSizeF

Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/core#1.8.0)

```
public @NonNull SizeF toSizeF()
```

Converts this `https://developer.android.com/reference/androidx/core/util/SizeFCompat` into a `https://developer.android.com/reference/android/util/SizeF.html`.

### toSizeFCompat

Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/core#1.8.0)

```
public static @NonNull SizeFCompat toSizeFCompat(@NonNull SizeF size)
```

Converts this `https://developer.android.com/reference/android/util/SizeF.html` into a `https://developer.android.com/reference/androidx/core/util/SizeFCompat`.

### toString

```
public @NonNull String toString()
```

## Extension functions

### SizeKt.component1

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/util/Size.kt+function:component1)

```
public final float SizeKt.component1(@NonNull SizeFCompat receiver)
```

Returns "width", the first component of this `https://developer.android.com/reference/androidx/core/util/SizeFCompat`.

This method allows to use destructuring declarations when working with sizes, for example:

```
val (w, h) = mySize
```

### SizeKt.component2

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/util/Size.kt+function:component2)

```
public final float SizeKt.component2(@NonNull SizeFCompat receiver)
```

Returns "height", the second component of this `https://developer.android.com/reference/androidx/core/util/SizeFCompat`.

This method allows to use destructuring declarations when working with sizes, for example:

```
val (w, h) = mySize
```